[JBoss Portal] - Re: Can not get user role from LDAP server
by saigon_man
Thanks a million for the tutorials. It worked perfectly. I am now able to connect to LDAP server and retrieve the user role. Here is that I've done in case of other people would like to know how to do it
1. Follow the instructions in those tutorials above for LDAP connection
2. To retrieve user roles,
2.1 add these codes into ldap_identity-config.xml
| <option-group>
| <group-name>common</group-name>
| <option>
| <name>userCtxDN</name>
| <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
| </option>
| <option>
| <name>roleCtxDN</name>
| <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
| </option>
| <option>
| <name>userSearchFilter</name>
| <value><![CDATA[(uid={0})]]></value>
| </option>
| <option>
| <name>roleSearchFilter</name>
| <value><![CDATA[(cn={0})]]></value>
| </option>
| <option>
| <name>membershipAttributeID</name>
| <value>member</value>
| </option>
|
| </option-group>
|
| <module>
| <!--type used to correctly map in IdentityContext registry-->
| <type>User</type>
| <implementation>LDAP</implementation>
| <class>org.jboss.portal.identity.ldap.LDAPExtUserModuleImpl</class>
| <config/>
| </module>
| <module>
| <type>Role</type>
| <implementation>LDAP</implementation>
| <class>org.jboss.portal.identity.ldap.LDAPExtRoleModuleImpl</class>
| <config/>
| </module>
| <module>
| <type>Membership</type>
| <implementation>LDAP</implementation>
| <class>org.jboss.portal.identity.ldap.LDAPStaticGroupMembershipModuleImpl</class>
| <config/>
| </module>
|
2.2 Here are some codes that retrieve all roles associates with a specific username
| try{
| MembershipModule membershipmodule = (MembershipModule)new InitialContext().lookup("java:/portal/MembershipModule");
| User user = usermodule.findUserByUserName("Put_your_username_ here");
| Set roles = membershipmodule.getRoles(user);
| Iterator iter = roles.iterator();
| while(iter.hasNext()){
| role = (Role)iter.next();
| System.out.println("Role: " + role.getDisplayName());
|
| }
| }catch(Exception e){
| // Do something here
| }
|
SGM
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090396#4090396
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090396
16Â years, 9Â months
[Beginners Corner] - Rather simple but doesn't work
by woo37830
I cd'd to my jboss-seam-1.2.1.GA directory and typed:
seam setup
then
seam new-project
then
seam explode
It all appeared to work, to create ear app to access some existing mySQL tables. The console in which JBoss app server was running gave me a dump however with the pertinent lines...
15:08:46,674 INFO [EARDeployer] Init J2EE application: file:/Applications/jboss-4.0.5.GA/server/default/deploy/seam_queuedb.ear/
15:08:47,441 ERROR [MainDeployer] Could not create deployment: file:/Applications/jboss-4.0.5.GA/server/default/deploy/seam_queuedb.ear/seam_queuedb.jar/
org.jboss.deployment.DeploymentException: ejb-jar.xml must either obey the right xml schema or define a valid DOCTYPE!
Now, I followed directions so why the failure? Also, I read that the ejb-jar.xml file is OPTIONAL. I followed the instructions, so why is it being asked for and what do I do about it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090387#4090387
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090387
16Â years, 9Â months