public class DelegatedAuthenticationDirectory extends AbstractForwardingDirectory implements RemoteDirectory
RemoteDirectory provides delegated
authentication to an underlying remote LDAP implementation.
In essence this means that a User's groups and roles are managed internally to Crowd and only authentication is delegated to the LDAP directory.
Users, group and memberships exist in an internal directory and all query and mutation operations execute on the internal directory.
For a user to successfully authenticate, they must exist in LDAP and must authenticate against LDAP. Passwords are not stored internally.
If the ATTRIBUTE_CREATE_USER_ON_AUTH attribute is
enabled, the delegated authentication directory will automatically
create the user in the internal portion of this directory, once they
successfully authenticate against LDAP. The initial user details, in
this case, will be obtained from LDAP.
If the ATTRIBUTE_UPDATE_USER_ON_AUTH attribute is
enabled, the delegated authentication directory will also update
the user's details from LDAP automatically whenever they
authenticate. The same behaviour will happen if the attribute is not
enabled and the user is deleted internally and then re-authenticates.
If the create-on-auth option is not enabled, then users must always be manually created in this directory, before they can authenticate against LDAP. In this scenario, the user details will never be retrieved from LDAP. This is OSUser's default LDAP behaviour.
| Modifier and Type | Field and Description |
|---|---|
static String |
ATTRIBUTE_CREATE_USER_ON_AUTH |
static String |
ATTRIBUTE_KEY_IMPORT_GROUPS |
static String |
ATTRIBUTE_LDAP_DIRECTORY_CLASS |
static String |
ATTRIBUTE_UPDATE_USER_ON_AUTH |
| Constructor and Description |
|---|
DelegatedAuthenticationDirectory(RemoteDirectory ldapDirectory,
InternalRemoteDirectory internalDirectory,
com.atlassian.event.api.EventPublisher eventPublisher,
DirectoryDao directoryDao) |
| Modifier and Type | Method and Description |
|---|---|
Group |
addGroup(GroupTemplate group) |
User |
addOrUpdateLdapUser(String name)
Copies or updates a user in the internal directory from their counterpart in the LDAP directory.
|
User |
authenticate(String name,
PasswordCredential credential)
In addition to the normal authentication behaviour, following a successful
authentication the following may occur:
If the user does not exist in the internal directory and
ATTRIBUTE_CREATE_USER_ON_AUTH is enabled, the user's details
will be added to the internal directory.
If the user exists in the internal directory and
ATTRIBUTE_UPDATE_USER_ON_AUTH is enabled, the user's details
will be updated in the internal directory.
If the user exists in the internal directory and
ATTRIBUTE_UPDATE_USER_ON_AUTH is enabled and
the username was changed in remote directory, the user's name
will be updated in the internal directory.
A user marked as inactive locally will not be authenticated, retrieved,
renamed or updated from the LDAP server. |
RemoteDirectory |
getAuthoritativeDirectory() |
protected InternalRemoteDirectory |
getDelegate() |
String |
getDescriptiveName() |
boolean |
isRolesDisabled() |
void |
setAttributes(Map<String,String> attributes) |
void |
setDirectoryId(long directoryId) |
boolean |
supportsNestedGroups() |
boolean |
supportsPasswordExpiration() |
boolean |
supportsSettingEncryptedCredential()
Delegated authentication directories don't support setting non-hashed credentials, let alone hashed credentials.
|
void |
testConnection() |
void |
updateUserCredential(String username,
PasswordCredential credential) |
User |
updateUserFromRemoteDirectory(User ldapUser) |
User |
userAuthenticated(String username) |
addGroupToGroup, addUser, addUser, addUserToGroup, countDirectMembersOfGroup, expireAllPasswords, findGroupByName, findGroupWithAttributesByName, findUserByExternalId, findUserByName, findUserWithAttributesByName, getDirectoryId, getKeys, getMemberships, getUserAvatarByName, getValue, getValues, isEmpty, isGroupDirectGroupMember, isUserDirectGroupMember, removeGroup, removeGroupAttributes, removeGroupFromGroup, removeUser, removeUserAttributes, removeUserFromGroup, renameGroup, renameUser, searchGroupRelationships, searchGroups, searchUsers, storeGroupAttributes, storeUserAttributes, supportsInactiveAccounts, updateGroup, updateUserclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddGroupToGroup, addUser, addUser, addUserToGroup, countDirectMembersOfGroup, expireAllPasswords, findGroupByName, findGroupWithAttributesByName, findUserByExternalId, findUserByName, findUserWithAttributesByName, getDirectoryId, getMemberships, getUserAvatarByName, isGroupDirectGroupMember, isUserDirectGroupMember, removeGroup, removeGroupAttributes, removeGroupFromGroup, removeUser, removeUserAttributes, removeUserFromGroup, renameGroup, renameUser, searchGroupRelationships, searchGroups, searchUsers, storeGroupAttributes, storeUserAttributes, supportsInactiveAccounts, updateGroup, updateUsergetKeys, getValue, getValues, isEmptypublic static final String ATTRIBUTE_CREATE_USER_ON_AUTH
public static final String ATTRIBUTE_UPDATE_USER_ON_AUTH
public static final String ATTRIBUTE_LDAP_DIRECTORY_CLASS
public static final String ATTRIBUTE_KEY_IMPORT_GROUPS
public DelegatedAuthenticationDirectory(RemoteDirectory ldapDirectory, InternalRemoteDirectory internalDirectory, com.atlassian.event.api.EventPublisher eventPublisher, DirectoryDao directoryDao)
public void setDirectoryId(long directoryId)
setDirectoryId in interface RemoteDirectorysetDirectoryId in class AbstractForwardingDirectorypublic String getDescriptiveName()
getDescriptiveName in interface RemoteDirectorygetDescriptiveName in class AbstractForwardingDirectorypublic void setAttributes(Map<String,String> attributes)
setAttributes in interface RemoteDirectorysetAttributes in class AbstractForwardingDirectorypublic User authenticate(String name, PasswordCredential credential) throws UserNotFoundException, InactiveAccountException, InvalidAuthenticationException, ExpiredCredentialException, OperationFailedException
ATTRIBUTE_CREATE_USER_ON_AUTH is enabled, the user's details
will be added to the internal directory.ATTRIBUTE_UPDATE_USER_ON_AUTH is enabled, the user's details
will be updated in the internal directory.ATTRIBUTE_UPDATE_USER_ON_AUTH is enabled and
the username was changed in remote directory, the user's name
will be updated in the internal directory.authenticate in interface RemoteDirectoryauthenticate in class AbstractForwardingDirectoryOperationFailedException - when user rename is not possibleUserNotFoundExceptionInactiveAccountExceptionInvalidAuthenticationExceptionExpiredCredentialExceptionRemoteDirectory.authenticate(String, PasswordCredential)public User userAuthenticated(String username) throws OperationFailedException, UserNotFoundException, InactiveAccountException
userAuthenticated in interface RemoteDirectoryOperationFailedExceptionUserNotFoundExceptionInactiveAccountExceptionpublic User updateUserFromRemoteDirectory(@Nonnull User ldapUser) throws OperationFailedException, UserNotFoundException
updateUserFromRemoteDirectory in interface RemoteDirectoryOperationFailedExceptionUserNotFoundExceptionpublic User addOrUpdateLdapUser(String name) throws UserNotFoundException, OperationFailedException
name - the username of the user to copyUserNotFoundException - if no user with the given username exists in LDAPOperationFailedException - if there was a problem communicating with the LDAP server or the user
could not be cloned to the internal directorypublic void updateUserCredential(String username, PasswordCredential credential) throws UserNotFoundException, InvalidCredentialException, OperationFailedException
updateUserCredential in interface RemoteDirectoryupdateUserCredential in class AbstractForwardingDirectoryUserNotFoundExceptionInvalidCredentialExceptionOperationFailedExceptionpublic Group addGroup(GroupTemplate group) throws InvalidGroupException, OperationFailedException
addGroup in interface RemoteDirectoryaddGroup in class AbstractForwardingDirectoryInvalidGroupExceptionOperationFailedExceptionpublic void testConnection()
throws OperationFailedException
testConnection in interface RemoteDirectorytestConnection in class AbstractForwardingDirectoryOperationFailedExceptionpublic boolean supportsNestedGroups()
supportsNestedGroups in interface RemoteDirectorysupportsNestedGroups in class AbstractForwardingDirectorypublic boolean supportsPasswordExpiration()
supportsPasswordExpiration in interface RemoteDirectorysupportsPasswordExpiration in class AbstractForwardingDirectorypublic boolean supportsSettingEncryptedCredential()
supportsSettingEncryptedCredential in interface RemoteDirectorysupportsSettingEncryptedCredential in class AbstractForwardingDirectoryfalse, always.public boolean isRolesDisabled()
isRolesDisabled in interface RemoteDirectoryisRolesDisabled in class AbstractForwardingDirectorypublic RemoteDirectory getAuthoritativeDirectory()
getAuthoritativeDirectory in interface RemoteDirectorygetAuthoritativeDirectory in class AbstractForwardingDirectoryprotected InternalRemoteDirectory getDelegate()
getDelegate in class AbstractForwardingDirectoryCopyright © 2018 Atlassian. All rights reserved.