public class DefaultAuthenticationStrategy extends Object implements IAuthenticationStrategy
Modifier and Type | Field and Description |
---|---|
protected String |
cookieKey
The cookie name to store the username and password
|
protected String |
encryptionKey
The key to use for encrypting/decrypting the cookie value
|
protected String |
VALUE_SEPARATOR
The separator used to concatenate the username and password
|
Constructor and Description |
---|
DefaultAuthenticationStrategy(String cookieKey)
Constructor
|
DefaultAuthenticationStrategy(String cookieKey,
String encryptionKey) |
Modifier and Type | Method and Description |
---|---|
protected String[] |
decode(String value)
This method will decode decrypted cookie value based on application needs
|
protected String |
encode(String credential,
String... extraCredentials)
This method can be overridden to provide different encoding mechanism
|
protected CookieUtils |
getCookieUtils()
Make sure you always return a valid CookieUtils
|
protected ICrypt |
getCrypt() |
String[] |
load()
If "rememberMe" is enabled, then load the saved credentials (e.g.
|
void |
remove()
When the user logs out (session invalidation), than remove username and password from the
persistence store
|
void |
save(String credential,
String... extraCredentials)
If "rememberMe" is enabled and login was successful, then store the given credentials in the
persistence store (e.g.
|
protected final String cookieKey
protected final String encryptionKey
protected final String VALUE_SEPARATOR
public DefaultAuthenticationStrategy(String cookieKey)
cookieKey
- The name of the cookieprotected CookieUtils getCookieUtils()
protected ICrypt getCrypt()
public String[] load()
IAuthenticationStrategy
load
in interface IAuthenticationStrategy
saved
credentialsprotected String[] decode(String value)
value
- decrypted cookie valuepublic void save(String credential, String... extraCredentials)
IAuthenticationStrategy
The implementation of this method should be symmetrical with the implementation of
IAuthenticationStrategy.load()
.
save
in interface IAuthenticationStrategy
credential
- The credential to store. For example: a security token or username.extraCredentials
- Optional extra credentials. For example: a passwordprotected String encode(String credential, String... extraCredentials)
credential
- extraCredentials
- public void remove()
IAuthenticationStrategy
remove
in interface IAuthenticationStrategy
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.