Class LdapIdentityProviderSession
- java.lang.Object
-
- org.camunda.bpm.identity.impl.ldap.LdapIdentityProviderSession
-
- All Implemented Interfaces:
ReadOnlyIdentityProvider,Session
public class LdapIdentityProviderSession extends java.lang.Object implements ReadOnlyIdentityProvider
LDAP
ReadOnlyIdentityProvider.- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.naming.ldap.LdapContextinitialContextprotected LdapConfigurationldapConfiguration
-
Constructor Summary
Constructors Constructor Description LdapIdentityProviderSession(LdapConfiguration ldapConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddFilter(java.lang.String attributeName, java.lang.String attributeValue, java.io.StringWriter writer)protected voidapplyRequestControls(AbstractQuery<?,?> query)booleancheckPassword(java.lang.String userId, java.lang.String password)voidclose()protected voidcloseLdapCtx(javax.naming.ldap.LdapContext context)protected java.lang.StringcomposeDn(java.lang.String... parts)GroupQuerycreateGroupQuery()GroupQuerycreateGroupQuery(CommandContext commandContext)NativeUserQuerycreateNativeUserQuery()Creates aNativeUserQuerythat allows to select users with native queries.TenantQuerycreateTenantQuery()TenantQuerycreateTenantQuery(CommandContext commandContext)UserQuerycreateUserQuery()UserQueryImplcreateUserQuery(CommandContext commandContext)protected voidensureContextInitialized()protected java.lang.StringescapeLDAPSearchFilter(java.lang.String filter)GroupfindGroupById(java.lang.String groupId)java.util.List<Group>findGroupByQueryCriteria(LdapGroupQuery query)longfindGroupCountByQueryCriteria(LdapGroupQuery ldapGroupQuery)TenantfindTenantById(java.lang.String id)UserfindUserById(java.lang.String userId)java.util.List<User>findUserByQueryCriteria(LdapUserQueryImpl query)longfindUserCountByQueryCriteria(LdapUserQueryImpl query)protected java.util.List<User>findUsersByGroupId(LdapUserQueryImpl query)java.util.List<User>findUsersWithoutGroupId(LdapUserQueryImpl query, java.lang.String userBaseDn, boolean ignorePagination)voidflush()protected java.lang.StringgetDnForGroup(java.lang.String groupId)protected java.lang.StringgetDnForUser(java.lang.String userId)protected java.lang.StringgetGroupSearchFilter(LdapGroupQuery query)protected java.lang.StringgetStringAttributeValue(java.lang.String attrName, javax.naming.directory.Attributes attributes)protected java.lang.StringgetUserSearchFilter(LdapUserQueryImpl query)protected booleanisAuthenticatedUser(UserEntity user)protected booleanisAuthorized(Permission permission, Resource resource, java.lang.String resourceId)protected javax.naming.ldap.InitialLdapContextopenContext(java.lang.String userDn, java.lang.String password)protected GroupEntitytransformGroup(javax.naming.directory.SearchResult result)protected LdapUserEntitytransformUser(javax.naming.directory.SearchResult result)
-
-
-
Field Detail
-
ldapConfiguration
protected LdapConfiguration ldapConfiguration
-
initialContext
protected javax.naming.ldap.LdapContext initialContext
-
-
Constructor Detail
-
LdapIdentityProviderSession
public LdapIdentityProviderSession(LdapConfiguration ldapConfiguration)
-
-
Method Detail
-
closeLdapCtx
protected void closeLdapCtx(javax.naming.ldap.LdapContext context)
-
openContext
protected javax.naming.ldap.InitialLdapContext openContext(java.lang.String userDn, java.lang.String password)
-
ensureContextInitialized
protected void ensureContextInitialized()
-
findUserById
public User findUserById(java.lang.String userId)
- Specified by:
findUserByIdin interfaceReadOnlyIdentityProvider- Returns:
- a
Userobject for the given user id or null if no such user exists.
-
createUserQuery
public UserQuery createUserQuery()
- Specified by:
createUserQueryin interfaceReadOnlyIdentityProvider- Returns:
- a
UserQueryobject which can be used for querying for users.
-
createUserQuery
public UserQueryImpl createUserQuery(CommandContext commandContext)
- Specified by:
createUserQueryin interfaceReadOnlyIdentityProvider- Returns:
- a
UserQueryobject which can be used in the current command context
-
createNativeUserQuery
public NativeUserQuery createNativeUserQuery()
Description copied from interface:ReadOnlyIdentityProviderCreates aNativeUserQuerythat allows to select users with native queries.- Specified by:
createNativeUserQueryin interfaceReadOnlyIdentityProvider- Returns:
- NativeUserQuery
-
findUserCountByQueryCriteria
public long findUserCountByQueryCriteria(LdapUserQueryImpl query)
-
findUserByQueryCriteria
public java.util.List<User> findUserByQueryCriteria(LdapUserQueryImpl query)
-
findUsersByGroupId
protected java.util.List<User> findUsersByGroupId(LdapUserQueryImpl query)
-
findUsersWithoutGroupId
public java.util.List<User> findUsersWithoutGroupId(LdapUserQueryImpl query, java.lang.String userBaseDn, boolean ignorePagination)
-
checkPassword
public boolean checkPassword(java.lang.String userId, java.lang.String password)- Specified by:
checkPasswordin interfaceReadOnlyIdentityProvider- Returns:
- 'true' if the password matches the
-
getUserSearchFilter
protected java.lang.String getUserSearchFilter(LdapUserQueryImpl query)
-
findGroupById
public Group findGroupById(java.lang.String groupId)
- Specified by:
findGroupByIdin interfaceReadOnlyIdentityProvider- Returns:
- a
Groupobject for the given group id or null if no such group exists.
-
createGroupQuery
public GroupQuery createGroupQuery()
- Specified by:
createGroupQueryin interfaceReadOnlyIdentityProvider- Returns:
- a
GroupQueryobject which can be used for querying for groups.
-
createGroupQuery
public GroupQuery createGroupQuery(CommandContext commandContext)
- Specified by:
createGroupQueryin interfaceReadOnlyIdentityProvider- Returns:
- a
GroupQueryobject which can be used for querying for groups and can be reused in the current command context.
-
findGroupCountByQueryCriteria
public long findGroupCountByQueryCriteria(LdapGroupQuery ldapGroupQuery)
-
findGroupByQueryCriteria
public java.util.List<Group> findGroupByQueryCriteria(LdapGroupQuery query)
-
getGroupSearchFilter
protected java.lang.String getGroupSearchFilter(LdapGroupQuery query)
-
getDnForUser
protected java.lang.String getDnForUser(java.lang.String userId)
-
getDnForGroup
protected java.lang.String getDnForGroup(java.lang.String groupId)
-
getStringAttributeValue
protected java.lang.String getStringAttributeValue(java.lang.String attrName, javax.naming.directory.Attributes attributes) throws javax.naming.NamingException- Throws:
javax.naming.NamingException
-
addFilter
protected void addFilter(java.lang.String attributeName, java.lang.String attributeValue, java.io.StringWriter writer)
-
transformUser
protected LdapUserEntity transformUser(javax.naming.directory.SearchResult result) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
transformGroup
protected GroupEntity transformGroup(javax.naming.directory.SearchResult result) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
applyRequestControls
protected void applyRequestControls(AbstractQuery<?,?> query)
-
composeDn
protected java.lang.String composeDn(java.lang.String... parts)
-
isAuthenticatedUser
protected boolean isAuthenticatedUser(UserEntity user)
- Returns:
- true if the passed-in user is currently authenticated
-
isAuthorized
protected boolean isAuthorized(Permission permission, Resource resource, java.lang.String resourceId)
-
escapeLDAPSearchFilter
protected final java.lang.String escapeLDAPSearchFilter(java.lang.String filter)
-
createTenantQuery
public TenantQuery createTenantQuery()
- Specified by:
createTenantQueryin interfaceReadOnlyIdentityProvider- Returns:
- a
TenantQueryobject which can be used for querying for tenants.
-
createTenantQuery
public TenantQuery createTenantQuery(CommandContext commandContext)
- Specified by:
createTenantQueryin interfaceReadOnlyIdentityProvider- Returns:
- a
TenantQueryobject which can be used for querying for tenants and can be reused in the current command context.
-
findTenantById
public Tenant findTenantById(java.lang.String id)
- Specified by:
findTenantByIdin interfaceReadOnlyIdentityProvider- Returns:
- a
Tenantobject for the given id or null if no such tenant exists.
-
-