public class JWTAuthenticationHandler extends AuthenticationHandler implements JPropertiesListener
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUTHENTICATION_FROM_JWT
Name of request attribute indicating that this request was authenticated using JWT
|
static java.lang.String |
JWT_CLAIM_DELEGATE_MEMBER_ID
Name of claim to specify the delegate member id to be set if athenticated with specified JWT Token.
|
static java.lang.String |
JWT_CLAIM_IP_MASK
Name of claim containing the IP mask defining IPs authorized with the JWT token.
|
static java.lang.String |
JWT_CLAIM_METHODS
Name of claim containing the HTTP methods authorized with the JWT token.
|
static java.lang.String |
JWT_CLAIM_URL
Name of claim containing the URL authorized to be access with the JWT token (can be an URL prefix prefix if claim
JWT_CLAIM_URL_PREFIX_LENGTH was specified) |
static java.lang.String |
JWT_CLAIM_URL_PREFIX_LENGTH
Name of claim containing the length of the URL authorized to be access with the JWT token (if unspecified, an exact URL match will be expected)
|
static java.lang.String |
JWT_CLAIMS
Name of request attribute used to store the JwtClaims that were validated for this request
|
static int |
ORDER_CLIENT_CERTIFICATE_HANDLER |
channel, GENERIC_BAD_AUTHENTICATION_MSG, REVISIONREVISION| Modifier and Type | Method and Description |
|---|---|
static JWTAuthenticationHandler |
getInstance() |
static org.jose4j.jwt.JwtClaims |
getJwtClaims(javax.servlet.http.HttpServletRequest request)
Retrieve the JWT claims that were validated for this request (as long it was authenticated using JWT).
|
static java.lang.String |
getJwtClaimsJson(javax.servlet.http.HttpServletRequest request)
Retrieve the JWT claims that were validated for this request (as long it was authenticated using JWT).
|
static boolean |
isAuthenticatedWithJWT(javax.servlet.http.HttpServletRequest request)
Check if the specified request was authenticated using a JWT token
|
boolean |
isEnabled() |
void |
loadProperties()
This method will be called by the AuthenticationManager each time the
Channel properties are loaded/reloaded.
You can use it to reload properties that might have been changed. This method is called during initialization of the AuthenticationManager |
void |
login(AuthenticationContext ctxt)
Authenticate a member.
|
void |
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.
|
public static final java.lang.String AUTHENTICATION_FROM_JWT
isAuthenticatedWithJWT(HttpServletRequest),
Constant Field Valuespublic static final java.lang.String JWT_CLAIMS
getJwtClaims(HttpServletRequest),
getJwtClaimsJson(HttpServletRequest),
Constant Field Valuespublic static final java.lang.String JWT_CLAIM_IP_MASK
public static final java.lang.String JWT_CLAIM_METHODS
public static final java.lang.String JWT_CLAIM_URL
JWT_CLAIM_URL_PREFIX_LENGTH was specified)public static final java.lang.String JWT_CLAIM_URL_PREFIX_LENGTH
public static final java.lang.String JWT_CLAIM_DELEGATE_MEMBER_ID
Example to propagate the current delegate member :
JwtClaims claims = JwtManager.getInstance().generateDefaultClaims(someMember, [...]);
claims.setClaim(JWTAuthenticationHandler.JWT_CLAIM_DELEGATE_MEMBER_ID, JcmsUtil.getId(Channel.getChannel().getCurrentDelegateMember()));
public static final int ORDER_CLIENT_CERTIFICATE_HANDLER
public static final JWTAuthenticationHandler getInstance()
public boolean isEnabled()
public void loadProperties()
AuthenticationHandlerloadProperties in class AuthenticationHandlerpublic void login(AuthenticationContext ctxt) throws java.io.IOException
AuthenticationHandlerAuthenticationContext object (request, response, login.. etc) AuthenticationContext.setLoggedMember(com.jalios.jcms.Member)AuthenticationContext.doChain(),AuthenticationContext.login in class AuthenticationHandlerctxt - the AuthenticationContext used for this loginjava.io.IOExceptionpublic void propertiesChange(JProperties properties)
JPropertiesListenerYou cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using channel.getProperties or
channel.getProperty.
propertiesChange in interface JPropertiesListenerproperties - the properties which have been submitted to changepublic static boolean isAuthenticatedWithJWT(javax.servlet.http.HttpServletRequest request)
request - the current HttpServletRequest, may be nullpublic static java.lang.String getJwtClaimsJson(javax.servlet.http.HttpServletRequest request)
request - the current HttpServletRequest, may be nullpublic static org.jose4j.jwt.JwtClaims getJwtClaims(javax.servlet.http.HttpServletRequest request)
request - the current HttpServletRequest, may be nullCopyright © 2001-2022 Jalios SA. All Rights Reserved.