Class UsernamePasswordContext


  • public abstract class UsernamePasswordContext
    extends LoginContext
    Simple LoginContext for a username and password, which may or may not be encrypted.
    Author:
    marrink
    • Constructor Detail

      • UsernamePasswordContext

        public UsernamePasswordContext()
        Constructor for logoff purposes.
      • UsernamePasswordContext

        public UsernamePasswordContext​(String username,
                                       String password)
        Constructor for login purposes.
        Parameters:
        username - the user attempting to login
        password - the password for the user
      • UsernamePasswordContext

        protected UsernamePasswordContext​(int sortOrder,
                                          boolean allowAdditionalLogins)
        Constructor for logoff purposes should you have chosen allow additional logins.
        Parameters:
        sortOrder -
        allowAdditionalLogins -
        See Also:
        LoginContext(int, boolean)
      • UsernamePasswordContext

        protected UsernamePasswordContext​(String username,
                                          String password,
                                          int sortOrder,
                                          boolean allowAdditionalLogins)
        Constructor for login purposes should you have chosen allow additional logins.
        Parameters:
        username - the user attempting to login
        password - the password for the user
        sortOrder -
        allowAdditionalLogins -
        See Also:
        LoginContext(int, boolean)
    • Method Detail

      • login

        public final Subject login()
                            throws org.wicketstuff.security.authentication.LoginException
        The username and password are always null after this method returns.
        Specified by:
        login in class LoginContext
        Returns:
        a Subject, never null.
        Throws:
        org.wicketstuff.security.authentication.LoginException - if an exception occurs or if the subject could not login for some other reason
        See Also:
        LoginContext.login()
      • getSubject

        protected abstract Subject getSubject​(String username,
                                              String password)
                                       throws org.wicketstuff.security.authentication.LoginException
        Validates the username and password.
        Parameters:
        username - the user attempting to login
        password - the password for the user
        Returns:
        a Subject representing the user.
        Throws:
        org.wicketstuff.security.authentication.LoginException - if the user could not be validated