Interface JwtTokenService
-
public interface JwtTokenService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
createToken(javax.servlet.http.HttpServletRequest request, Map<String,Object> claims)
Returns a signed JWT (JWS) token for anHttpServletRequest
that has been authenticated containing anHttpSession
that can be retrieved viaCmsSessionContext.getContext(HttpSession)
.AccessToken
getAccessToken(String jws)
-
-
-
Method Detail
-
createToken
String createToken(javax.servlet.http.HttpServletRequest request, Map<String,Object> claims)
Returns a signed JWT (JWS) token for an
HttpServletRequest
that has been authenticated containing anHttpSession
that can be retrieved viaCmsSessionContext.getContext(HttpSession)
. If the request has not already been authenticated or does not have itsHttpSession
attached to theCmsSessionContext
, anIllegalStateException
is thrown- Parameters:
request
- the HttpServletRequest which must have an http session that has been authenticated alreadyclaims
- the claims to add to the token, for example which branch to render, if no extra claims, use empty map. The Objects need to be serializable to json- Returns:
- a signed JWT token
- Throws:
IllegalStateException
- if the http request does not yet have an authenticatedHttpSession
or does not yet have it attached to theCmsSessionContext
viaCmsContextService.attachSessionContext(String, HttpSession)
-
getAccessToken
AccessToken getAccessToken(String jws) throws InvalidTokenException
- Parameters:
jws
- the signed JWT token- Returns:
- An
AccessToken
object - Throws:
InvalidTokenException
- in case the JWT token is not bound to a validCmsSessionContext
(any more)TokenException
- in case the jwt service is not initialized or some unexpected exception happened not being catched and thrown as a InvalidTokenException
-
-