org.apache.jetspeed.security.spi.impl.ldap
Class LdapUserPrincipalDaoImpl

java.lang.Object
  extended by org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
      extended by org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDaoImpl
          extended by org.apache.jetspeed.security.spi.impl.ldap.LdapUserPrincipalDaoImpl
All Implemented Interfaces:
LdapPrincipalDao, LdapReadOnlyPrincipalDao, LdapUserPrincipalDao

public class LdapUserPrincipalDaoImpl
extends LdapPrincipalDaoImpl
implements LdapUserPrincipalDao

Author:
Mike Long , David Le Strat

Field Summary
 
Fields inherited from class org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
ctx
 
Constructor Summary
LdapUserPrincipalDaoImpl()
           Default constructor.
LdapUserPrincipalDaoImpl(LdapBindingConfig ldapConfig)
           Initializes the dao.
 
Method Summary
 void addGroup(java.lang.String userPrincipalUid, java.lang.String groupPrincipalUid)
           Add a user to a group.
 void addRole(java.lang.String userPrincipalUid, java.lang.String rolePrincipalUid)
           Add a user to a group.
 void addRoleToGroup(java.lang.String groupPrincipalUid, java.lang.String rolePrincipalUid)
           Add a role to a group.
protected  javax.naming.directory.Attributes defineLdapAttributes(java.lang.String principalUid)
           A template method for defining the attributes for a particular LDAP class.
protected  java.lang.String[] getAttributes()
           
protected  java.lang.String getDnSuffix()
           Builds the dn suffix.
protected  java.lang.String getEntryPrefix()
           A template method that returns the LDAP entry prefix of the concrete DAO.
 java.lang.String[] getGroupUidsForUser(java.lang.String userPrincipalUid)
          Return the list of group IDs for a particular user
protected  java.lang.String[] getObjectClasses()
           
 java.lang.String[] getRolesForGroup(java.lang.String groupPrincipalUid)
           Return an array of the roles that belong to a group.
 java.lang.String[] getRoleUidsForUser(java.lang.String userPrincipalUid)
          Returns the role IDs for a particular user Looks up the user, and extracts the rolemembership attr (ex : uniquemember)
protected  java.lang.String getSearchSuffix()
           A template method that returns the LDAP entry prefix of the concrete DAO.
protected  java.lang.String getUidAttributeForPrincipal()
           Builds the dn suffix.
 java.lang.String[] getUserUidsForGroup(java.lang.String groupPrincipalUid)
           Return an array of the user principal UIDS that belong to a group.
 java.lang.String[] getUserUidsForRole(java.lang.String rolePrincipalUid)
           Return an array of the user principal UIDS that belong to a group.
protected  java.security.Principal makePrincipal(java.lang.String principalUid)
           Creates a GroupPrincipal object.
 void removeGroup(java.lang.String userPrincipalUid, java.lang.String groupPrincipalUid)
           Remove a user from a group.
 void removeRole(java.lang.String userPrincipalUid, java.lang.String rolePrincipalUid)
           Remove a user from a group.
 void removeRoleFromGroup(java.lang.String groupPrincipalUid, java.lang.String rolePrincipalUid)
           Remove a role from a group.
 
Methods inherited from class org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDaoImpl
convertUidToLdapAcceptableName, create, delete, find, getAttribute, getGroupDN, getGroupDN, getRoleDN, getRoleDN, getSearchDomain, getUserDN, getUserDN, parseAttr
 
Methods inherited from class org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
bindToServer, getGroupAttributes, getGroupFilter, getGroupFilterBase, getGroupIdAttribute, getGroupMembershipAttribute, getGroupMembershipForRoleAttribute, getGroupObjectClasses, getGroupObjectRequiredAttributeClasses, getGroupUidAttribute, getKnownAttributes, getRoleAttributes, getRoleFilter, getRoleFilterBase, getRoleGroupMembershipForRoleAttribute, getRoleIdAttribute, getRoleMembershipAttribute, getRoleObjectClasses, getRoleObjectRequiredAttributeClasses, getRoleUidAttribute, getRootContext, getSearchScope, getSubcontextName, getUidAttribute, getUserAttributes, getUserFilter, getUserFilterBase, getUserGroupMembershipAttribute, getUserIdAttribute, getUserObjectClasses, getUserPasswordAttribute, getUserRoleMembershipAttribute, getUserUidAttribute, lookupByUid, searchByWildcardedUid, searchGroupByWildcardedUid, searchRoleByWildcardedUid, setSearchControls, validateDn, validatePassword, validateUid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDao
convertUidToLdapAcceptableName, create, delete, find
 
Methods inherited from interface org.apache.jetspeed.security.spi.impl.ldap.LdapReadOnlyPrincipalDao
lookupByUid
 

Constructor Detail

LdapUserPrincipalDaoImpl

public LdapUserPrincipalDaoImpl()
                         throws SecurityException

Default constructor.

Throws:
SecurityException - A SecurityException.

LdapUserPrincipalDaoImpl

public LdapUserPrincipalDaoImpl(LdapBindingConfig ldapConfig)
                         throws SecurityException

Initializes the dao.

Parameters:
ldapConfig - Holds the ldap binding configuration.
Throws:
SecurityException - A SecurityException.
Method Detail

addGroup

public void addGroup(java.lang.String userPrincipalUid,
                     java.lang.String groupPrincipalUid)
              throws SecurityException
Description copied from interface: LdapUserPrincipalDao

Add a user to a group.

Specified by:
addGroup in interface LdapUserPrincipalDao
Parameters:
userPrincipalUid - The user principal.
groupPrincipalUid - The group principal.
Throws:
SecurityException - A SecurityException.
See Also:
LdapUserPrincipalDao.addGroup(java.lang.String, java.lang.String)

removeGroup

public void removeGroup(java.lang.String userPrincipalUid,
                        java.lang.String groupPrincipalUid)
                 throws SecurityException
Description copied from interface: LdapUserPrincipalDao

Remove a user from a group.

Specified by:
removeGroup in interface LdapUserPrincipalDao
Parameters:
userPrincipalUid - The user principal.
groupPrincipalUid - The group principal.
Throws:
SecurityException - A SecurityException.
See Also:
LdapUserPrincipalDao.removeGroup(java.lang.String, java.lang.String)

addRole

public void addRole(java.lang.String userPrincipalUid,
                    java.lang.String rolePrincipalUid)
             throws SecurityException
Description copied from interface: LdapUserPrincipalDao

Add a user to a group.

Specified by:
addRole in interface LdapUserPrincipalDao
Parameters:
userPrincipalUid - The user principal.
rolePrincipalUid - The role principal.
Throws:
SecurityException - A SecurityException.
See Also:
LdapUserPrincipalDao.addGroup(java.lang.String, java.lang.String)

removeRole

public void removeRole(java.lang.String userPrincipalUid,
                       java.lang.String rolePrincipalUid)
                throws SecurityException
Description copied from interface: LdapUserPrincipalDao

Remove a user from a group.

Specified by:
removeRole in interface LdapUserPrincipalDao
Parameters:
userPrincipalUid - The user principal.
rolePrincipalUid - The role principal.
Throws:
SecurityException - A SecurityException.
See Also:
LdapUserPrincipalDao.removeGroup(java.lang.String, java.lang.String)

defineLdapAttributes

protected javax.naming.directory.Attributes defineLdapAttributes(java.lang.String principalUid)

A template method for defining the attributes for a particular LDAP class.

Specified by:
defineLdapAttributes in class LdapPrincipalDaoImpl
Parameters:
principalUid - The principal uid.
Returns:
the LDAP attributes object for the particular class.

makePrincipal

protected java.security.Principal makePrincipal(java.lang.String principalUid)

Creates a GroupPrincipal object.

Specified by:
makePrincipal in class LdapPrincipalDaoImpl
Parameters:
principalUid - The principal uid.
Returns:
A group principal object.

addRoleToGroup

public void addRoleToGroup(java.lang.String groupPrincipalUid,
                           java.lang.String rolePrincipalUid)
                    throws SecurityException
Description copied from interface: LdapUserPrincipalDao

Add a role to a group.

Specified by:
addRoleToGroup in interface LdapUserPrincipalDao
Parameters:
groupPrincipalUid - The group principal.
rolePrincipalUid - The role principal.
Throws:
SecurityException - A SecurityException.
See Also:
LdapUserPrincipalDao.addGroup(java.lang.String, java.lang.String)

removeRoleFromGroup

public void removeRoleFromGroup(java.lang.String groupPrincipalUid,
                                java.lang.String rolePrincipalUid)
                         throws SecurityException
Description copied from interface: LdapUserPrincipalDao

Remove a role from a group.

Specified by:
removeRoleFromGroup in interface LdapUserPrincipalDao
Parameters:
groupPrincipalUid - The group principal.
rolePrincipalUid - The role principal.
Throws:
SecurityException - A SecurityException.
See Also:
LdapUserPrincipalDao.removeGroup(java.lang.String, java.lang.String)

getGroupUidsForUser

public java.lang.String[] getGroupUidsForUser(java.lang.String userPrincipalUid)
                                       throws SecurityException
Return the list of group IDs for a particular user

Specified by:
getGroupUidsForUser in interface LdapUserPrincipalDao
Parameters:
userPrincipalUid -
Returns:
the array of group uids asociated with this user
Throws:
SecurityException

getRolesForGroup

public java.lang.String[] getRolesForGroup(java.lang.String groupPrincipalUid)
                                    throws SecurityException

Return an array of the roles that belong to a group.

Specified by:
getRolesForGroup in interface LdapUserPrincipalDao
Parameters:
groupPrincipalUid - The group principal uid.
Returns:
The array of user uids asociated with this group
Throws:
SecurityException - A SecurityException.

getRoleUidsForUser

public java.lang.String[] getRoleUidsForUser(java.lang.String userPrincipalUid)
                                      throws SecurityException
Returns the role IDs for a particular user Looks up the user, and extracts the rolemembership attr (ex : uniquemember)

Specified by:
getRoleUidsForUser in interface LdapUserPrincipalDao
Parameters:
userPrincipalUid -
Returns:
the array of group uids asociated with this user
Throws:
SecurityException

getUserUidsForGroup

public java.lang.String[] getUserUidsForGroup(java.lang.String groupPrincipalUid)
                                       throws SecurityException

Return an array of the user principal UIDS that belong to a group.

Specified by:
getUserUidsForGroup in interface LdapUserPrincipalDao
Parameters:
groupPrincipalUid - The group principal uid.
Returns:
The array of user uids asociated with this group
Throws:
SecurityException - A SecurityException.

getUserUidsForRole

public java.lang.String[] getUserUidsForRole(java.lang.String rolePrincipalUid)
                                      throws SecurityException

Return an array of the user principal UIDS that belong to a group.

Specified by:
getUserUidsForRole in interface LdapUserPrincipalDao
Parameters:
groupPrincipalUid - The group principal uid.
Returns:
The array of user uids asociated with this group
Throws:
SecurityException - A SecurityException.

getObjectClasses

protected java.lang.String[] getObjectClasses()
Specified by:
getObjectClasses in class AbstractLdapDao

getAttributes

protected java.lang.String[] getAttributes()
Specified by:
getAttributes in class AbstractLdapDao

getUidAttributeForPrincipal

protected java.lang.String getUidAttributeForPrincipal()
Description copied from class: LdapPrincipalDaoImpl

Builds the dn suffix.

Specified by:
getUidAttributeForPrincipal in class LdapPrincipalDaoImpl
Returns:
The dn suffix.

getEntryPrefix

protected java.lang.String getEntryPrefix()
Description copied from class: AbstractLdapDao

A template method that returns the LDAP entry prefix of the concrete DAO.

TODO : this should be in spring config

Specified by:
getEntryPrefix in class AbstractLdapDao
Returns:
a String containing the LDAP entry prefix name.

getSearchSuffix

protected java.lang.String getSearchSuffix()
Description copied from class: AbstractLdapDao

A template method that returns the LDAP entry prefix of the concrete DAO.

TODO : this should be in spring config

Specified by:
getSearchSuffix in class AbstractLdapDao
Returns:
a String containing the LDAP entry prefix name.

getDnSuffix

protected java.lang.String getDnSuffix()
Description copied from class: LdapPrincipalDaoImpl

Builds the dn suffix.

Specified by:
getDnSuffix in class LdapPrincipalDaoImpl
Returns:
The dn suffix.


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.