Class InternalUserSource

    • Constructor Detail

      • InternalUserSource

        public InternalUserSource​(UserSourceProfileKernel kernel,
                                  int pwdHistory,
                                  int pwdMinLength,
                                  int pwdComplexity,
                                  int pwdMaxAge)
    • Method Detail

      • createDefaultUserSource

        public static long createDefaultUserSource​(GatewayContext context)
                                            throws java.lang.Exception
        Creates an internal user source called "default" with user "admin"/"password" and role "Administrator". Returns the long id of the new profile.
        Throws:
        java.lang.Exception
      • createFirstUser

        public static long createFirstUser​(GatewayContext context,
                                           java.lang.String username,
                                           java.lang.String password,
                                           boolean preEncrypted)
                                    throws java.lang.Exception
        Creates an internal user source called "default" with the supplied username and password and role "Administrator". Returns the long id of the new profile.
        Parameters:
        context - The GatewayContext instance
        username - The username, Must not be null
        password - The password either pre-encrypted or not. Must not be null
        Returns:
        The profile id.
        Throws:
        java.lang.Exception
      • authenticate

        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:
        java.lang.Exception
      • getUsers

        @NotNull
        public @NotNull java.util.Collection<User> getUsers()
        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.
      • getRoles

        @NotNull
        public @NotNull java.util.Collection<java.lang.String> getRoles()
                                                                 throws java.lang.Exception
        Returns:
        a collection of all possible role names for this profile. May be empty
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • validatePassword

        public java.lang.String validatePassword​(@Nonnull
                                                 User user,
                                                 java.lang.String password)
        Description copied from interface: UserSourceProfile
        Validate the given password. Note that this doesn't mean it checks to see if this password matches the user's current password. Rather, it means that this password would be an acceptable new password for the user.
        Returns:
        A i18n key for the error message describing why the password is invalid, or null if the password is valid.
      • findUserInternalId

        protected java.lang.Long findUserInternalId​(PersistenceSession session,
                                                    User user)