Class LdapIdentityProviderSession

    • Field Detail

      • initialContext

        protected javax.naming.ldap.LdapContext initialContext
    • Constructor Detail

      • LdapIdentityProviderSession

        public LdapIdentityProviderSession​(LdapConfiguration ldapConfiguration)
    • Method Detail

      • flush

        public void flush()
        Specified by:
        flush in interface Session
      • close

        public void close()
        Specified by:
        close in interface Session
      • 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()
      • findUserCountByQueryCriteria

        public long findUserCountByQueryCriteria​(LdapUserQueryImpl query)
      • findUserByQueryCriteria

        public java.util.List<User> findUserByQueryCriteria​(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:
        checkPassword in interface ReadOnlyIdentityProvider
        Returns:
        'true' if the password matches the
      • getUserSearchFilter

        protected java.lang.String getUserSearchFilter​(LdapUserQueryImpl query)
      • 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
      • getSortingControls

        protected java.util.List<javax.naming.ldap.Control> getSortingControls​(AbstractQuery<?,​?> query,
                                                                               java.lang.StringBuilder resultLogger)
        Return the list of Controls requested in the query. Query may be run on USERS or on GROUP
        Parameters:
        query - query asks, contains the order by requested
        Returns:
        list of control to send to LDAP
      • 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)
      • initializeControls

        protected void initializeControls​(AbstractQuery<?,​?> query,
                                          java.lang.StringBuilder resultLogger)
                                   throws javax.naming.NamingException
        Initializes paged results and sort controls. Might not be supported by all LDAP implementations.
        Throws:
        javax.naming.NamingException
      • isNextPageDetected

        protected boolean isNextPageDetected​(java.lang.StringBuilder resultLogger)
        Check in the context if we reach the last page on the query
        Parameters:
        resultLogger - Logger to send information
        Returns:
        new page detected
      • isPaginationSupported

        protected boolean isPaginationSupported()
      • getPageSize

        protected java.lang.Integer getPageSize()
        Return the pageSize. Returns null if pagination is disabled.
        Returns:
        the pageSize