Class DefaultAuthenticationStrategy

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String cookieKey
      The cookie name to store the username and password
      protected String encryptionKey
      Deprecated, for removal: This API element is subject to removal in a future version.
      no longer used TODO remove in Wicket 10
      protected String VALUE_SEPARATOR
      The separator used to concatenate the username and password
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultAuthenticationStrategy​(String cookieKey)
      Deprecated, for removal: This API element is subject to removal in a future version.
      supply a crypt instead TODO remove in Wicket 10
      DefaultAuthenticationStrategy​(String cookieKey, String encryptionKey)
      Deprecated, for removal: This API element is subject to removal in a future version.
      supply a crypt instead TODO remove in Wicket 10
      DefaultAuthenticationStrategy​(String cookieKey, ICrypt crypt)
      This is the recommended constructor to be used, which allows automatic authentication across application restarts.
    • Constructor Detail

      • DefaultAuthenticationStrategy

        @Deprecated(forRemoval=true)
        public DefaultAuthenticationStrategy​(String cookieKey)
        Deprecated, for removal: This API element is subject to removal in a future version.
        supply a crypt instead TODO remove in Wicket 10
        Constructor
        Parameters:
        cookieKey - The name of the cookie
      • DefaultAuthenticationStrategy

        public DefaultAuthenticationStrategy​(String cookieKey,
                                             ICrypt crypt)
        This is the recommended constructor to be used, which allows automatic authentication across application restarts.
        Parameters:
        cookieKey - The name of the cookie
        crypt - the crypt
    • Method Detail

      • getCookieUtils

        protected CookieUtils getCookieUtils()
        Make sure you always return a valid CookieUtils
        Returns:
        CookieUtils
      • getCrypt

        protected ICrypt getCrypt()
        Returns:
        The crypt engine to be used
      • load

        public String[] load()
        Description copied from interface: IAuthenticationStrategy
        If "rememberMe" is enabled, then load the saved credentials (e.g. username and password) from the persistence storage (e.g. Cookie) for automatic sign in. This is useful for applications which users typically have open the whole day but where the server invalidates the session after a timeout and you want to force the user to sign in again and again during the day.
        Specified by:
        load in interface IAuthenticationStrategy
        Returns:
        The saved credentials
      • decode

        protected String[] decode​(String value)
        This method will decode decrypted cookie value based on application needs
        Parameters:
        value - decrypted cookie value
        Returns:
        decomposed values array, or null in case cookie value was empty.
      • save

        public void save​(String credential,
                         String... extraCredentials)
        Description copied from interface: IAuthenticationStrategy
        If "rememberMe" is enabled and login was successful, then store the given credentials in the persistence store (e.g. Cookie).

        The implementation of this method should be symmetrical with the implementation of IAuthenticationStrategy.load().

        Specified by:
        save in interface IAuthenticationStrategy
        Parameters:
        credential - The credential to store. For example: a security token or username.
        extraCredentials - Optional extra credentials. For example: a password
      • encode

        protected String encode​(String credential,
                                String... extraCredentials)
        This method can be overridden to provide different encoding mechanism
        Parameters:
        credential -
        extraCredentials -
        Returns:
        String representation of the parameters given