public interface StatelessUtil
Modifier and Type | Method and Description |
---|---|
org.springframework.http.ResponseCookie |
createSavedRequestCookie(String requestUrl,
String redirectUrl)
Create a cookie containing a JWT token identifying an originating request url and a redirect
url.
|
org.springframework.http.ResponseCookie |
createSavedRequestRemovalCookie()
Create a cookie that can be passed to the response to clear any existing saved request cookie
in the browser.
|
javax.servlet.http.Cookie |
createSessionCookie(OAuth2SessionToken sessionToken)
Deprecated.
in favor of
getSessionCookie(OAuth2SessionToken) |
com.nimbusds.jwt.SignedJWT |
generateSignedJwt(String subject,
Map<String,Object> claims,
Long expiresInSeconds)
Generate a signed JWT with issuer and audience values as well as optional additional claims.
|
String |
getClientId(String savedRequestToken) |
Map<String,Object> |
getCookieClaims(String cookieValue)
Get a Map of the claims from a SignedJWT cookie.
|
String |
getIssuer() |
String |
getRedirectUrl(javax.servlet.http.Cookie savedRequestCookie)
Verify the JWT token contained in the cookie and then return the redirect url contained
therein.
|
org.springframework.http.ResponseCookie |
getRemovalCookie(javax.servlet.http.Cookie cookieToRemove)
Returns a removal cookie for any arbitrary cookie.
|
javax.servlet.http.Cookie |
getRemoveSavedRequestCookie()
Deprecated.
since 1.6, replaced by
createSavedRequestRemovalCookie() |
javax.servlet.http.Cookie |
getRemoveSessionCookie(String clientId)
Deprecated.
in favor of
getSessionRemovalCookie(String) |
String |
getRequestUrl(javax.servlet.http.Cookie savedRequestCookie)
Verify the JWT token contained in the cookie and then return the original request url
contained therein.
|
javax.servlet.http.Cookie |
getSavedRequestCookie(String requestUrl,
String redirectUrl)
Deprecated.
since 1.6, replaced by
createSavedRequestCookie(String, String) |
String |
getSavedRequestCookieName()
Get the standard name for a saved request cookie
|
String |
getSavedRequestJwt(String requestUrl,
String redirectUrl) |
org.springframework.http.ResponseCookie |
getSessionCookie(OAuth2SessionToken sessionToken)
Gets a
ResponseCookie for the OAuth2SessionToken . |
String |
getSessionCookieName(AuthorizedClient client,
AuthorizationServer server) |
String |
getSessionCookieName(String clientId)
Get the standard name for a session cookie
|
org.springframework.http.ResponseCookie |
getSessionRemovalCookie(String clientId)
Gets a
ResponseCookie for the removal of the session cookie. |
OAuth2SessionToken |
getSessionToken(String clientId,
String userId,
String subject,
Map<String,Object> additionalClaims)
Creates a
OAuth2SessionToken for the provided client ID and subject with the set of
additional claims. |
OAuth2SessionToken |
refreshSessionToken(OAuth2SessionToken sessionToken)
Returns a
OAuth2SessionToken with a refreshed expiration time. |
com.nimbusds.jwt.SignedJWT |
verify(String token)
Verify the signature of a signed JWT inside a cookie
|
OAuth2SessionToken getSessionToken(String clientId, String userId, String subject, Map<String,Object> additionalClaims)
OAuth2SessionToken
for the provided client ID and subject with the set of
additional claims.clientId
- the client IDuserId
- subject
- the user subjectadditionalClaims
- the additional session claimsOAuth2SessionToken refreshSessionToken(OAuth2SessionToken sessionToken)
OAuth2SessionToken
with a refreshed expiration time.sessionToken
- the session tokenString getRedirectUrl(javax.servlet.http.Cookie savedRequestCookie)
savedRequestCookie
- see createSavedRequestCookie(String, String)
createSavedRequestCookie(String, String)
String getRequestUrl(javax.servlet.http.Cookie savedRequestCookie)
savedRequestCookie
- see createSavedRequestCookie(String, String)
createSavedRequestCookie(String, String)
Map<String,Object> getCookieClaims(String cookieValue)
cookieValue
- @Deprecated javax.servlet.http.Cookie createSessionCookie(OAuth2SessionToken sessionToken)
getSessionCookie(OAuth2SessionToken)
OAuth2SessionToken
.sessionToken
- the session token@Deprecated javax.servlet.http.Cookie getRemoveSessionCookie(String clientId)
getSessionRemovalCookie(String)
clientId
- org.springframework.http.ResponseCookie getSessionCookie(OAuth2SessionToken sessionToken)
ResponseCookie
for the OAuth2SessionToken
.sessionToken
- the session tokenorg.springframework.http.ResponseCookie getSessionRemovalCookie(String clientId)
ResponseCookie
for the removal of the session cookie.clientId
- the client ID@Deprecated javax.servlet.http.Cookie getSavedRequestCookie(String requestUrl, String redirectUrl)
createSavedRequestCookie(String, String)
requestUrl
- the original request (e.g. /oauth/authorize)redirectUrl
- the uri to redirect to for authentication (e.g. /login)org.springframework.http.ResponseCookie createSavedRequestCookie(String requestUrl, String redirectUrl)
requestUrl
- the original request (e.g. /oauth/authorize)redirectUrl
- the uri to redirect to for authentication (e.g. /login)@Deprecated javax.servlet.http.Cookie getRemoveSavedRequestCookie()
createSavedRequestRemovalCookie()
org.springframework.http.ResponseCookie createSavedRequestRemovalCookie()
createSavedRequestCookie(String, String)
com.nimbusds.jwt.SignedJWT verify(String token)
token
- the cookie to verifycom.nimbusds.jwt.SignedJWT generateSignedJwt(@Nullable String subject, @Nullable Map<String,Object> claims, @Nullable Long expiresInSeconds)
subject
- The subject of the JWTclaims
- Additional claims to add to the JWTString getSessionCookieName(String clientId)
clientId
- #getSessionCookie(String, String)
String getSessionCookieName(AuthorizedClient client, AuthorizationServer server)
String getIssuer()
String getSavedRequestCookieName()
createSavedRequestCookie(String, String)
org.springframework.http.ResponseCookie getRemovalCookie(javax.servlet.http.Cookie cookieToRemove)
cookieToRemove
- The cookie to target for removalHttpServletResponse
to
remove the supplied cookie.Copyright © 2021. All rights reserved.