1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef EXTENSIONS_CONFIG_LDAP_LDAPACCESS_HXX_
21 #define EXTENSIONS_CONFIG_LDAP_LDAPACCESS_HXX_
23 #include "sal/config.h"
34 #include <com/sun/star/ldap/LdapGenericException.hpp>
36 #include <com/sun/star/ldap/LdapConnectionException.hpp>
37 #include <com/sun/star/lang/IllegalArgumentException.hpp>
38 #include <osl/module.h>
40 namespace extensions
{ namespace config
{ namespace ldap
{
42 namespace uno
= css::uno
;
43 namespace lang
= css::lang
;
44 namespace ldap
= css::ldap
;
45 //------------------------------------------------------------------------------
46 struct LdapUserProfile
;
48 //------------------------------------------------------------------------------
49 /** Struct containing the information on LDAP connection */
52 /** LDAP server name */
54 /** LDAP server port number */
56 /** Repository base DN */
58 /** DN to use for "anonymous" connection */
60 /** Credentials to use for "anonymous" connection */
61 OUString mAnonCredentials
;
62 /** User Entity Object Class */
63 OUString mUserObjectClass
;
64 /** User Entity Unique Attribute */
65 OUString mUserUniqueAttr
;
68 typedef std::map
< OUString
, OUString
> LdapData
; // key/value pairs
70 /** Class encapulating all LDAP functionality */
73 friend struct LdapMessageHolder
;
76 /** Default constructor */
77 LdapConnection(void) : mConnection(NULL
),mLdapDefinition() {}
78 /** Destructor, releases the connection */
79 ~LdapConnection(void) ;
80 /** Make connection to LDAP server */
81 void connectSimple(const LdapDefinition
& aDefinition
)
82 throw (ldap::LdapConnectionException
,
83 ldap::LdapGenericException
);
86 Gets LdapUserProfile from LDAP repository for specified user
87 @param aUser name of logged on user
88 @param aUserProfileMap Map containing LDAP->00o mapping
89 @param aUserProfile struct for holding OOo values
91 @throws com::sun::star::ldap::LdapGenericException
92 if an LDAP error occurs.
94 void getUserProfile(const OUString
& aUser
, LdapData
* data
)
95 throw (lang::IllegalArgumentException
,
96 ldap::LdapConnectionException
,
97 ldap::LdapGenericException
);
102 OUString
findUserDn(const OUString
& aUser
)
103 throw (lang::IllegalArgumentException
,
104 ldap::LdapConnectionException
,
105 ldap::LdapGenericException
);
109 void initConnection()
110 throw (ldap::LdapConnectionException
);
113 Indicates whether the connection is in a valid state.
114 @return sal_True if connection is valid, sal_False otherwise
116 bool isValid(void) const { return mConnection
!= NULL
; }
119 throw (ldap::LdapConnectionException
,
120 ldap::LdapGenericException
);
122 /** LDAP connection object */
124 LdapDefinition mLdapDefinition
;
127 //------------------------------------------------------------------------------
130 #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */