public class CookieAuthenticationHandler extends Object implements AuthenticationHandler
| Modifier and Type | Field and Description |
|---|---|
static int |
SECONDS_PER_YEAR |
| Constructor and Description |
|---|
CookieAuthenticationHandler(NonceProvider nonceProvider,
List<AuthenticationHandler> handlers,
ResourceFactory principalResourceFactory,
List<String> keys) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendChallenges(Resource resource,
Request request,
List<String> challenges)
Create a challenge for this authentication method.
|
Object |
authenticate(Resource resource,
Request request)
Authenticate the details in the request for access to the given
resource.
|
boolean |
credentialsPresent(Request request)
Determine if there are login credentials present.
|
String |
encodeUserUrl(String userUrl) |
String |
getCookieNameUserUrl() |
String |
getCookieNameUserUrlHash() |
String |
getHashFromRequest(Request request) |
String |
getLoginToken(String userUrl,
Request request) |
String |
getLoginToken(String userUrl,
Request request,
String host) |
String |
getLoginToken(String userUrl,
String urlSigningHash) |
String |
getLoginTokenName() |
String |
getUrlSigningHash(String userUrl,
Request request)
The hmac signs a message in the form nonce || userUrl, where the nonce is
requested from the nonceProvider
This method returns a signing token in the form nonce || hmac
|
String |
getUrlSigningHash(String userUrl,
Request request,
String host) |
String |
getUserUrl(Request request)
Find a previous login token in the request, and if present verify its
authenticity via a signing cookie
|
String |
getUserUrlAttName() |
String |
getUserUrlFromRequest(Request request) |
boolean |
isCompatible(Resource resource,
Request request)
Returns true if this authentication handler is compatible with the given
resource
This is used when authorisation has failed, in generating challenge responses
If you don't want to add a challenge response, return false
|
boolean |
isUseLongLivedCookies() |
void |
setLoginCookies(DiscretePrincipal user,
Request request)
Sets cookies to make the given user the currently logged in user for any
subsequent requests.
|
void |
setLoginCookies(String userUrl,
Request request) |
void |
setUseLongLivedCookies(boolean useLongLivedCookies) |
void |
setUserUrlAttName(String userUrlAttName) |
boolean |
supports(Resource r,
Request request)
Returns true if this supports authenticating with the given Auth data
on the given resource.
|
public static final int SECONDS_PER_YEAR
public CookieAuthenticationHandler(NonceProvider nonceProvider, List<AuthenticationHandler> handlers, ResourceFactory principalResourceFactory, List<String> keys)
public boolean credentialsPresent(Request request)
AuthenticationHandlercredentialsPresent in interface AuthenticationHandlerpublic boolean supports(Resource r, Request request)
AuthenticationHandlersupports in interface AuthenticationHandlerr - - the resource being accesspublic Object authenticate(Resource resource, Request request)
AuthenticationHandlerauthenticate in interface AuthenticationHandlerpublic void setLoginCookies(DiscretePrincipal user, Request request)
user - request - public void appendChallenges(Resource resource, Request request, List<String> challenges)
AuthenticationHandlerappendChallenges in interface AuthenticationHandlerchallenges - - the list of challenges to append to, or not, as appropriatepublic boolean isCompatible(Resource resource, Request request)
AuthenticationHandlerisCompatible in interface AuthenticationHandlerpublic String getUserUrl(Request request)
request - public String getUrlSigningHash(String userUrl, Request request)
userUrl - request - public String getCookieNameUserUrlHash()
public String getCookieNameUserUrl()
public String getUserUrlAttName()
public String getLoginTokenName()
public void setUserUrlAttName(String userUrlAttName)
public void setUseLongLivedCookies(boolean useLongLivedCookies)
public boolean isUseLongLivedCookies()
Copyright © 2021 McEvoy Software Ltd. All rights reserved.