Class DatabaseAutomaticUserSource

    • Method Detail

      • validateTables

        public void validateTables()
      • authenticate

        @Nullable
        public AuthenticatedUser authenticate​(AuthChallenge challenge)
                                       throws java.lang.Exception
        Description copied from interface: UserSourceProfile
        Called to both verify authentication for a given username/password pair, and to find the security roles for that user.
        Returns:
        An AuthenticatedUser that contains the user's roles if authentication succeeded, or null if it did not.
        Throws:
        PasswordExpiredException - if the user's password has expired and must be reset
        java.lang.Exception - if there was an unexpected problem encountered during authentication
      • getUsers

        @Nonnull
        public java.util.Collection<User> getUsers()
                                            throws java.lang.Exception
        Description copied from interface: UserSourceProfile
        Retrieve all users from this profile. This can execute slowly (block) if need be. It will be called periodically by the manager and the results will be cached. Users from failover sources will be returned if hard failover is configured and triggered.
        Specified by:
        getUsers in interface UserSourceProfile
        Specified by:
        getUsers in class AbstractUserSourceProfile
        Throws:
        java.lang.Exception
      • getUser

        @Nonnull
        public java.util.Optional<User> getUser​(java.lang.String userName)
                                         throws java.lang.Exception
        Description copied from interface: UserSourceProfile
        Fetch a User with the given user name. If more than one user exists with the given user name, the first user returned from the underlying data source is returned. Failover sources will be queried if hard failover is configured and the primary sources are unable to fetch the user due to an error. Failover sources will also be queried if soft failover is configured and the user is not found in the primary sources.
        Specified by:
        getUser in interface UserSourceProfile
        Overrides:
        getUser in class AbstractUserSourceProfile
        Parameters:
        userName - the user name of the User to fetch
        Returns:
        an Optional User with the given user name. the user may be from a failover user source (check User.getProfileName() to confirm)
        Throws:
        java.lang.Exception - if there is an unexpected problem fetching the user with the given user name
        See Also:
        UserSourceProfile.getUser(String, String)
      • getRoles

        @Nonnull
        public java.util.Collection<java.lang.String> getRoles()
                                                        throws java.lang.Exception
        Specified by:
        getRoles in interface UserSourceProfile
        Specified by:
        getRoles in class AbstractUserSourceProfile
        Returns:
        a collection of all possible role names for this profile. May be empty. Roles from failover sources will be returned if hard failover is configured and triggered.
        Throws:
        java.lang.Exception
      • setDatabaseId

        public void setDatabaseId​(long databaseId)
      • setPrefix

        public void setPrefix​(java.lang.String prefix)