By: Flo Goss user 07 Apr 2016 at 10:12 a.m. CDT

9 Responses
Flo Goss gravatar
Hello, How do I search for an user and get its attributes from internal LDAP in a custom script ? Is there any documentation about that or a Javadoc for the related classes ?

By Aliaksandr Samuseu staff 07 Apr 2016 at 10:56 a.m. CDT

Aliaksandr Samuseu gravatar
Hi, Flo. Some of hints refer to this custom script: [link](https://github.com/GluuFederation/oxAuth/blob/master/Server/integrations/gplus/GooglePlusExternalAuthenticator.py), it creates user and searches for a user at some points.

By Aliaksandr Samuseu staff 07 Apr 2016 at 10:59 a.m. CDT

Aliaksandr Samuseu gravatar
Here is `UserService` class's definition you can use for full list of its capabilities: [link](https://github.com/GluuFederation/oxAuth/blob/20f7cfe77312254fd9991f7b9f23517aa207ab39/Server/src/main/java/org/xdi/oxauth/service/UserService.java)

By Flo Goss user 08 Apr 2016 at 4:54 a.m. CDT

Flo Goss gravatar
Hi Aliaksandr, Thanks a lot. Unfortunately, I can't access the link https://support.gluu.org/integrations/mfa-custom-script-storing-user-token-2545 because I get "You are not autorized to see requested page!"

By Aliaksandr Samuseu staff 08 Apr 2016 at 11:20 a.m. CDT

Aliaksandr Samuseu gravatar
Sorry, forgot about that. Here is a quote you need: userService.addUserAttribute(user_name, "LDAPAttributeName", user_uid) And to find user by this "LDAPAttributeName" we use: find_user_by_LDAPAttributeName = userService.getUserByAttribute("LDAPAttributeName", user_uid) It's standard approach to store all external GUIDs in "oxExternalUid" with prefix. Also we instruct LDAP to index this attribute to do quick search. Please refer to the links I provided above to see full list of functions you can employ and how to use them.

By Flo Goss user 11 Apr 2016 at 5:53 a.m. CDT

Flo Goss gravatar
Hi Aliaksandr, Very interesting. Does that only apply when using SAML to authenticate with 3rd party system identifier ? Btw, I still can't access https://support.gluu.org/integrations/mfa-custom-script-storing-user-token-2545. "You are not autorized to see requested page!"

By Aliaksandr Samuseu staff 11 Apr 2016 at 10:38 a.m. CDT

Aliaksandr Samuseu gravatar
> "You are not autorized to see requested page!" Yes, you aren't supposed to, it's a private ticket of a customer. >Does that only apply when using SAML to authenticate with 3rd party system identifier It's just an example of how to use functions of `userService` class to achieve what you need. You can use it in any custom script, afaik.

By Flo Goss user 12 Apr 2016 at 8:58 a.m. CDT

Flo Goss gravatar
> Yes, you aren't supposed to, it's a private ticket of a customer. Ok. I'm just a little bit confuse on how to create this user_uid you're talking about in your previous post, because user_name is already uid in internal LDAP.

By Aliaksandr Samuseu staff 12 Apr 2016 at 10:24 a.m. CDT

Aliaksandr Samuseu gravatar
Do not mind namings in this example and always refer to that class definition I provided when in doubt: public User getUserByAttribute(String attributeName, String attributeValue) So user_uid is just a value you are searching for.

By Flo Goss user 15 Apr 2016 at 7:47 a.m. CDT

Flo Goss gravatar
Thanks for your support.