Package org.keycloak.util
Class TokenUtil
java.lang.Object
org.keycloak.util.TokenUtil
- Author:
- Marek Posolda
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
attachOIDCScope
(String scopeParam) static RefreshToken
getRefreshToken
(byte[] decodedToken) Return refresh token or offline tokenstatic RefreshToken
getRefreshToken
(String refreshToken) static boolean
static boolean
static boolean
isOfflineToken
(String refreshToken) Return true if given refreshToken represents offline tokenstatic boolean
isOfflineTokenRequested
(String scopeParam) static boolean
isOIDCRequest
(String scopeParam) static String
jweDirectEncode
(Key aesKey, Key hmacKey, byte[] contentBytes) static String
jweDirectEncode
(Key aesKey, Key hmacKey, JsonWebToken jwt) static byte[]
jweDirectVerifyAndDecode
(Key aesKey, Key hmacKey, String jweStr) static <T extends JsonWebToken>
TjweDirectVerifyAndDecode
(Key aesKey, Key hmacKey, String jweStr, Class<T> expectedClass) static String
jweKeyEncryptionEncode
(Key encryptionKEK, byte[] contentBytes, String algAlgorithm, String encAlgorithm, String kid, JWEAlgorithmProvider jweAlgorithmProvider, JWEEncryptionProvider jweEncryptionProvider) static String
jweKeyEncryptionEncode
(Key encryptionKEK, byte[] contentBytes, String algAlgorithm, String encAlgorithm, String kid, JWEAlgorithmProvider jweAlgorithmProvider, JWEEncryptionProvider jweEncryptionProvider, String jweContentType) static byte[]
jweKeyEncryptionVerifyAndDecode
(Key decryptionKEK, String encodedContent) static byte[]
jweKeyEncryptionVerifyAndDecode
(Key decryptionKEK, String encodedContent, JWEAlgorithmProvider algorithmProvider, JWEEncryptionProvider encryptionProvider)
-
Field Details
-
TOKEN_TYPE_BEARER
- See Also:
-
TOKEN_TYPE_DPOP
- See Also:
-
TOKEN_TYPE_KEYCLOAK_ID
- See Also:
-
TOKEN_TYPE_ID
- See Also:
-
TOKEN_TYPE_REFRESH
- See Also:
-
TOKEN_TYPE_OFFLINE
- See Also:
-
TOKEN_TYPE_LOGOUT
- See Also:
-
TOKEN_BACKCHANNEL_LOGOUT_EVENT
- See Also:
-
TOKEN_BACKCHANNEL_LOGOUT_EVENT_REVOKE_OFFLINE_TOKENS
- See Also:
-
-
Constructor Details
-
TokenUtil
public TokenUtil()
-
-
Method Details
-
attachOIDCScope
-
isOIDCRequest
-
isOfflineTokenRequested
-
hasScope
-
hasPrompt
-
getRefreshToken
Return refresh token or offline token- Parameters:
decodedToken
-- Returns:
- Throws:
JWSInputException
-
getRefreshToken
- Throws:
JWSInputException
-
isOfflineToken
Return true if given refreshToken represents offline token- Parameters:
refreshToken
-- Returns:
- Throws:
JWSInputException
-
jweDirectEncode
- Throws:
JWEException
-
jweDirectVerifyAndDecode
public static <T extends JsonWebToken> T jweDirectVerifyAndDecode(Key aesKey, Key hmacKey, String jweStr, Class<T> expectedClass) throws JWEException - Throws:
JWEException
-
jweKeyEncryptionEncode
public static String jweKeyEncryptionEncode(Key encryptionKEK, byte[] contentBytes, String algAlgorithm, String encAlgorithm, String kid, JWEAlgorithmProvider jweAlgorithmProvider, JWEEncryptionProvider jweEncryptionProvider) throws JWEException - Throws:
JWEException
-
jweKeyEncryptionEncode
public static String jweKeyEncryptionEncode(Key encryptionKEK, byte[] contentBytes, String algAlgorithm, String encAlgorithm, String kid, JWEAlgorithmProvider jweAlgorithmProvider, JWEEncryptionProvider jweEncryptionProvider, String jweContentType) throws JWEException - Throws:
JWEException
-
jweKeyEncryptionVerifyAndDecode
public static byte[] jweKeyEncryptionVerifyAndDecode(Key decryptionKEK, String encodedContent) throws JWEException - Throws:
JWEException
-
jweKeyEncryptionVerifyAndDecode
public static byte[] jweKeyEncryptionVerifyAndDecode(Key decryptionKEK, String encodedContent, JWEAlgorithmProvider algorithmProvider, JWEEncryptionProvider encryptionProvider) throws JWEException - Throws:
JWEException
-
jweDirectEncode
public static String jweDirectEncode(Key aesKey, Key hmacKey, byte[] contentBytes) throws JWEException - Throws:
JWEException
-
jweDirectVerifyAndDecode
public static byte[] jweDirectVerifyAndDecode(Key aesKey, Key hmacKey, String jweStr) throws JWEException - Throws:
JWEException
-