public class JWTConsumer extends Object implements org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected String |
authoritiesParameterName |
protected JWTAuthorityConnector |
jwtAuthorityConnector |
protected JWTRequestResponseHandler |
jwtRequestResponseHandler |
protected String |
sessionIdParameterName |
protected io.jsonwebtoken.SigningKeyResolver |
signingKeyResolver |
static String |
SPRING_SECURITY_JWT_AUTHORITIES_PARAMETER_NAME |
static String |
SPRING_SECURITY_JWT_SESSION_ID_PARAMETER_NAME |
static String |
SPRING_SECURITY_JWT_XSRF_PARAMETER_NAME |
protected static Integer |
TEN_YEARS_IN_SECONDS |
protected String |
xsrfParameterName |
| Constructor and Description |
|---|
JWTConsumer() |
JWTConsumer(JWTAuthorityConnector jwtAuthorityConnector) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
JWTContext |
authenticateJWTRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected JWTContext |
createJWTContext(String principal,
String sessionId,
String xsrfToken,
Collection<? extends org.springframework.security.core.GrantedAuthority> authorities,
String jwtMode,
String jwtToken) |
protected String |
extractPrincipal(io.jsonwebtoken.Claims claims) |
protected String |
extractSessionId(io.jsonwebtoken.Claims claims) |
protected Collection<org.springframework.security.core.GrantedAuthority> |
getAuthorities(io.jsonwebtoken.Claims claims) |
protected String |
getJWTModeFromParameters(Parameters parameters) |
JWTRequestResponseHandler |
getJwtRequestResponseHandler() |
protected void |
handleJWTContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
JWTContext jwtContext) |
void |
setAuthoritiesParameterName(String authoritiesParameterName) |
void |
setJWTAuthorityConnector(JWTAuthorityConnector jwtAuthorityConnector) |
void |
setJwtRequestResponseHandler(JWTRequestResponseHandler jwtRequestResponseHandler) |
void |
setSessionIdParameterName(String sessionIdParameterName) |
void |
setSigningKeyResolver(io.jsonwebtoken.SigningKeyResolver signingKeyResolver) |
void |
setXsrfParameterName(String xsrfParameterName) |
JWTContext |
validate(TokenContainer tokenContainer,
Parameters parameters) |
protected void |
validateXSRF(io.jsonwebtoken.Claims claims,
String xsrfToken) |
protected static final Integer TEN_YEARS_IN_SECONDS
public static final String SPRING_SECURITY_JWT_XSRF_PARAMETER_NAME
public static final String SPRING_SECURITY_JWT_SESSION_ID_PARAMETER_NAME
public static final String SPRING_SECURITY_JWT_AUTHORITIES_PARAMETER_NAME
protected String authoritiesParameterName
protected String sessionIdParameterName
protected String xsrfParameterName
protected JWTAuthorityConnector jwtAuthorityConnector
protected io.jsonwebtoken.SigningKeyResolver signingKeyResolver
protected JWTRequestResponseHandler jwtRequestResponseHandler
public JWTConsumer()
public JWTConsumer(JWTAuthorityConnector jwtAuthorityConnector)
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic JWTContext authenticateJWTRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public JWTContext validate(TokenContainer tokenContainer, Parameters parameters) throws InvalidTokenException, ExpiredTokenException
public void setSigningKeyResolver(io.jsonwebtoken.SigningKeyResolver signingKeyResolver)
public void setJWTAuthorityConnector(JWTAuthorityConnector jwtAuthorityConnector)
public void setJwtRequestResponseHandler(JWTRequestResponseHandler jwtRequestResponseHandler)
public JWTRequestResponseHandler getJwtRequestResponseHandler()
public void setAuthoritiesParameterName(String authoritiesParameterName)
public void setXsrfParameterName(String xsrfParameterName)
public void setSessionIdParameterName(String sessionIdParameterName)
protected void handleJWTContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
JWTContext jwtContext)
protected void validateXSRF(io.jsonwebtoken.Claims claims,
String xsrfToken)
protected String extractPrincipal(io.jsonwebtoken.Claims claims)
protected String extractSessionId(io.jsonwebtoken.Claims claims)
protected Collection<org.springframework.security.core.GrantedAuthority> getAuthorities(io.jsonwebtoken.Claims claims)
protected JWTContext createJWTContext(String principal, String sessionId, String xsrfToken, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities, String jwtMode, String jwtToken)
protected String getJWTModeFromParameters(Parameters parameters)
Copyright © 2019 S&C Software. All rights reserved.