1 package fnd_ldap_util AUTHID CURRENT_USER as
2 /* $Header: AFSCOLTS.pls 120.8.12010000.4 2009/04/24 18:37:40 rsantis ship $ */
3 --
4 /*****************************************************************************/
5
6 type ldap_user_type is record (
7 object_name varchar2(1024)
8 , uid varchar2(1024)
9 , sn varchar2(4000)
10 , cn varchar2(4000)
11 , userPassword varchar2(4000)
12 , telephoneNumber varchar2(4000)
13 , street varchar2(4000)
14 , postalCode varchar2(4000)
15 , physicalDeliveryOfficeName varchar2(4000)
16 , st varchar2(4000)
17 , l varchar2(4000)
18 , displayName varchar2(4000)
19 , givenName varchar2(4000)
20 , homePhone varchar2(4000)
21 , mail varchar2(4000)
22 , c varchar2(4000)
23 , facsimileTelephoneNumber varchar2(4000)
24 , description varchar2(4000)
25 , orclisEnabled varchar2(4000)
26 , orclActiveStartDate varchar2(4000)
27 , orclActiveEndDate varchar2(4000)
28 , orclGUID varchar2(4000)
29 );
30
31
32 type ldap_record_values is table of dbms_ldap.STRING_COLLECTION index by varchar2(200);
33
34 type ldap_record_type is record (
35 dn varchar2(4000),
36 data ldap_record_values
37 );
38
39
40 -- Start of Package Globals
41
42 G_SUCCESS constant pls_integer := 1;
43 G_FAILURE constant pls_integer := 0;
44 G_TRUE constant pls_integer := 1;
45 G_FALSE constant pls_integer := 0;
46
47 G_MAIL constant varchar2(4) := 'MAIL';
48 G_FACSIMILETELEPHONENUMBER constant varchar2(24) := 'FACSIMILETELEPHONENUMBER';
49 G_COM_PROD_ORCLECTX constant varchar2(4000) := 'cn=Common,cn=Products,cn=OracleContext';
50
51 G_INTERNAL constant varchar2(9) := '#INTERNAL';
52 G_LDAP_SYNCH constant varchar2(10) := 'LDAP_SYNCH';
53 G_HOST constant varchar2(4) := 'HOST';
54 G_PORT constant varchar2(4) := 'PORT';
55 G_USERNAME constant varchar2(8) := 'USERNAME';
56 G_EPWD constant varchar2(4) := 'EPWD';
57 G_LDAP_PWD constant varchar2(8) := 'LDAP_PWD';
58 G_DBLDAPAUTHLEVEL constant varchar2(15) := 'dbldapauthlevel';
59 G_DBWALLETDIR constant varchar2(11) := 'dbwalletdir';
60 G_DBWALLETPASS constant varchar2(12) := 'dbwalletpass';
61 -- default DAS operation url base
62 G_DEFAULT_BASE constant varchar2(100) := 'cn=OperationURLs,cn=DAS,cn=Products,cn=OracleContext';
63 -- End of Package Globals
64 --
65 -------------------------------------------------------------------------------
66 /*
67 ** Name : get_oid_session
68 ** Type : Public, FND Internal
69 ** Desc :
70 ** Pre-Reqs :
71 ** Parameters :
72 */
73 function get_oid_session return dbms_ldap.session;
74
75 function c_get_oid_session(flag in out nocopy pls_integer) return dbms_ldap.session;
76 procedure c_unbind(ldap in out nocopy dbms_ldap.session , flag in out nocopy pls_integer);
77 --
78 -------------------------------------------------------------------------------
79 /*
80 ** Name : unbind
81 ** Type : Public, FND Internal
82 ** Desc : This function unbinds an ldap_session
83 ** Pre-Reqs :
84 ** Parameters :
85 ** Notes :
86 */
87 function unbind(p_session in out nocopy dbms_ldap.session) return pls_integer;
88 --
89 -------------------------------------------------------------------------------
90 /*
91 ** Name : get_orclappname
92 ** Type : Public, FND Internal
93 ** Desc : This function returns orclAppName from Workflow
94 ** Pre-Reqs :
95 ** Parameters :
96 ** Notes :
97 */
98 function get_orclappname return varchar2;
99 --
100 -------------------------------------------------------------------------------
101 /*
102 ** Name : get_users_nodes
103 ** Type : Public, FND Internal
104 ** Desc : This function gets the value of orclcommondefaultusercreatebase
105 from OID
106 ** Pre-Reqs :
107 ** Parameters :
108 ** Notes :
109 ** DEPRECATED AND REMOVED, use
110 ** get_user_create_base(username)
111 ** get_user_search_base(username)
112
113 **
114 */
115 -- function get_users_nodes return dbms_ldap.string_collection;
116
117 -------------------------------------------------------------------------------
118 /*
119 ** Name : get_user_create_base
120 ** Type : Public, FND Internal
121 ** Desc : This function returns the DN where the user should be created
122 ** Pre-Reqs :
123 ** Parameters :
124 ** Notes :
125 **
126 */
127 --function get_user_create_base(username in out nocopy varchar2) return varchar2;
128
129 -------------------------------------------------------------------------------
130 /*
131 ** Name : get_user_search_base
132 ** Type : Public, FND Internal
133 ** Desc : This function returns the DN where the user can be searched
134 ** Pre-Reqs :get_user_create_base
135 ** Parameters :
136 ** Notes :
137 **
138 */
139 --function get_users_search_base(username in out nocopy varchar2) return varchar2;
140
141
142 --
143 -------------------------------------------------------------------------------
144 /*
145 ** Name : get_search_nodes
146 ** Type : Public, FND Internal
147 ** Desc : This function gets the value of orclcommonusersearchbase
148 from OID
149 ** Pre-Reqs :
150 ** Parameters :
151 ** Notes : REMOVED , use get_User_create_base(username)/ get_user_search_base(username)
152 */
153 -- function get_search_nodes return dbms_ldap.string_collection;
154 --
155 -------------------------------------------------------------------------------
156 /*
157 ** Name : get_mandatory_user_attrib
158 ** Type : Public, FND Internal
159 ** Desc : This function gets the value of orclcommonnicknameattribute from
160 OID
161 ** Pre-Reqs :
162 ** Parameters :
163 ** Notes :
164 */
165 --function get_orclcommonnicknameattr(username in out nocopy varchar2) return varchar2;
166 --
167 -------------------------------------------------------------------------------
168 /*
169 ** Name : get_dn_for_guid
170 ** Type : Public, FND Internal
171 ** Desc : This function gets the dn for user specified by the guid
172 ** Pre-Reqs :
173 ** Parameters : orcl_guid
174 ** Notes :
175 */
176 function get_dn_for_guid(p_orclguid in fnd_user.user_guid%type) return varchar2;
177 --
178 -------------------------------------------------------------------------------
179 /*
180 ** Name : get_dn_for_guid
181 ** Type : Public, FND Internal
182 ** Desc : This function gets the dn for user specified by the guid
183 ** Pre-Reqs :
184 ** Parameters : orcl_guid
185 ** Notes :
186 */
187 function get_dn_for_guid(p_orclguid in fnd_user.user_guid%type,
188 p_ldap_session in dbms_ldap.session) return varchar2;
189 --
190 -------------------------------------------------------------------------------
191 /*
192 ** Name : get_default_realm
193 ** Type : Public, FND Internal
194 ** Desc : This function gets the default realm from OID
195 ** Pre-Reqs :
196 ** Parameters :
197 ** Notes : removed , use get_realm(username) instead
198 */
199 -- function get_default_realm return varchar2;
200
201 -------------------------------------------------------------------------------
202 /*
203 ** Name : get_realm
204 ** Type : Public, FND Internal
205 ** Desc : This function gets the default realm from OID
206 ** Pre-Reqs :
207 ** Parameters :
208 ** Notes : removed , use get_realm(username) instead
209 */
210 -- function get_default_realm(username in out nocopy varchar2) return varchar2;
211
212 --
213 -------------------------------------------------------------------------------
214 /*
215 ** Name : get_guid_for_dn
216 ** Type : Private (? , probably others will need this ,
217 ** is it a candidate for the API ?
218 ** Desc : Given and DN return its orclguid
219 ** if DN is not found, the raise "NO_DATA_FOUND'
220
221 ** Parameters :
222 ** aDN: the application DN, for example
223 ** orclApplicationCommonName=PROD1,cn=EBusiness,cn=Products,cn=OracleContext,dc=us,dc=oracle,dc=com
224 ** Returns :
225 ** Its orclguid
226 ** If it is NULL then the DN does not have a orcGuild attribute
227 ** Exceptions:
228 ** DATA_NOT_FOUND if search_s raise DBMS_LDAP.GENERAL_EXCEPTION
229 ** NOte that this DBMS_LDAP exception maybe risen by other reasons
230 **
231 */
232 function get_guid_for_dn(ldapSession in dbms_ldap.session,p_dn in varchar2) return varchar2;
233
234 --
235 -------------------------------------------------------------------------------
236 /*
237 ** Name : proxy_as_user
238 ** Type : Public, FND Internal
239 ** Desc : This procedure proxies as the given user. This is used when we don't
240 ** want to expire a user's password in cases such as a user updating
241 ** one's own password
242 ** Pre-Reqs :
243 ** Parameters : p_orclguid: GUID of the user that acts a proxy user
244 ** x_ldap_session: returns a valid OID session. Must be released bu caller of
245 ** the API
246 ** Notes :
247 */
248 procedure proxy_as_user(p_orclguid in fnd_user.user_guid%type, x_ldap_session out nocopy dbms_ldap.session);
249 --
250 -------------------------------------------------------------------------------
251
252 /*
253 ** Name : get_DAS_OperationUrl
254 ** Type : Public, FND Internal
255 ** Desc : This functions return and URL suitable for the requested operation
256 ** Support multiple realms specific definitions.
257 ** Pre-Reqs :
258 ** Parameters : p_orclguid: GUID of the user that acts a proxy user
259 ** x_ldap_session: returns a valid OID session. Must be released bu caller of
260 ** the API
261 ** Notes :
262 ** There are lot of Urls, most used maybe
263 ** Password Change
264 ** TimeZone
265 ** Edit My Profile
266 ** View User Profile
267 ** Reset Password
268 */
269
270 function get_DAS_OperationUrl(p_realm in varchar2, p_operation in varchar2) return varchar2;
271 --
272 -------------------------------------------------------------------------------
273 /*
274 ** Name : add_attribute_M
275 ** Type : Public, FND Internal
276 ** Desc : This procedure add an attribute to an entry when then attribute has
277 ** multiple values
278 ** Pre-Reqs :
279 ** Parameters : p_orclguid: GUID of the user that acts a proxy user
280 ** x_ldap_session: returns a valid OID session. Must be released bu caller of
281 ** the API
282 ** Notes :
283 */
284 procedure add_attribute_M(x_ldap in dbms_ldap.session, dn in varchar2, name in varchar2, value in varchar2 );
285 --
286 -------------------------------------------------------------------------------
287
288
289 /**
290 ** INTERNAL ATG-SSO
291 **/
292
293 function getLDAPAttribute(
294 ldap in out nocopy dbms_ldap.session,
295 dn in varchar2,
296 attrName in varchar2,
297 filterExp in varchar2 default 'objectclass=*')
298 return varchar2;
299 --
300 ------------------------------------------------------------------------------
301
302 G_GUID_KEY pls_integer :=0;
303 G_DN_KEY pls_integer :=1;
304
305 function loadLdapRecord( ldapSession in out nocopy dbms_ldap.session, rec in out nocopy ldap_record_type,
306 key in varchar2, key_type in pls_integer default G_DN_KEY ) return boolean;
307
308 function loadLdapRecord( ldapSession in out nocopy dbms_ldap.session, rec in out nocopy ldap_record_values, dn out nocopy varchar2,
309 key in varchar2, key_type in pls_integer default G_DN_KEY ) return boolean;
310
311 end fnd_ldap_util;