Class IdTokenHelper
java.lang.Object
de.hybris.platform.oauth2.jwt.util.IdTokenHelper
The Class IdTokenHelper for building, encoding and signing JSON Web Tokens.
Example usage: IdTokenHelper idTokenHelper = new IdTokenHelper.IdTokenBuilder( new IdTokenHelper.HeaderBuilder().alg(algorithm).kid(kid).getHeaders(), new IdTokenHelper.ClaimsBuilder().iss(issuer).nonce(nonce).state(state) .sub(authentication.getPrincipal().toString()).iat().exp(idTokenValiditySeconds) .setScopes(SCOPE_CLAIM_NAME, "openid") .addScopes(EXTERNAL_SCOPE_CLAIM_NAME, externalScopes) .getClaims()) .build();
org.springframework.security.jwt.Jwt jwt = idTokenHelper.encodeAndSign(signer);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Builder for Claims.static classThe Builder for Header.static classBuilder for JWT (contains claims and headers). -
Method Summary
Modifier and TypeMethodDescriptionfinal org.springframework.security.jwt.JwtencodeAndSign(org.springframework.security.jwt.crypto.sign.Signer signer) Encode and sign the JWT.voidsetHeaders(Map<String, String> headers) Sets the headers.
-
Method Details
-
setHeaders
Sets the headers.- Parameters:
headers- the headers to set
-
encodeAndSign
public final org.springframework.security.jwt.Jwt encodeAndSign(org.springframework.security.jwt.crypto.sign.Signer signer) Encode and sign the JWT.- Parameters:
signer- the signer- Returns:
- signed jwt
-