Class TokenUtils
- java.lang.Object
-
- org.keycloak.authentication.actiontoken.TokenUtils
-
public class TokenUtils extends Object
- Author:
- hmlnarik
-
-
Constructor Summary
Constructors Constructor Description TokenUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TokenVerifier.Predicate<JsonWebToken>checkThat(BooleanSupplier function, String errorEvent, String errorMessage)Returns a predicate for use inTokenVerifierusing the given boolean-returning function.static <T extends JsonWebToken>
TokenVerifier.Predicate<T>checkThat(Predicate<T> function, String errorEvent, String errorMessage)Returns a predicate for use inTokenVerifierusing the given boolean-returning function.static <T extends JsonWebToken>
TokenVerifier.Predicate<T>onlyIf(Predicate<T> condition, TokenVerifier.Predicate<T> predicate)Returns a predicate that is applied only if the givenconditionevaluates to .static <T extends JsonWebToken>
TokenVerifier.Predicate<? super T>[]predicates(TokenVerifier.Predicate<? super T>... predicate)
-
-
-
Method Detail
-
checkThat
public static TokenVerifier.Predicate<JsonWebToken> checkThat(BooleanSupplier function, String errorEvent, String errorMessage)
Returns a predicate for use inTokenVerifierusing the given boolean-returning function. When the function returnfalse, this predicate throws aExplainedTokenVerificationExceptionwithmessageanderrorEventset fromerrorMessageanderrorEvent, .- Parameters:
function-errorEvent-errorMessage-- Returns:
-
checkThat
public static <T extends JsonWebToken> TokenVerifier.Predicate<T> checkThat(Predicate<T> function, String errorEvent, String errorMessage)
Returns a predicate for use inTokenVerifierusing the given boolean-returning function. When the function returnfalse, this predicate throws aExplainedTokenVerificationExceptionwithmessageanderrorEventset fromerrorMessageanderrorEvent, .- Parameters:
function-errorEvent-errorMessage-- Returns:
-
onlyIf
public static <T extends JsonWebToken> TokenVerifier.Predicate<T> onlyIf(Predicate<T> condition, TokenVerifier.Predicate<T> predicate)
Returns a predicate that is applied only if the givenconditionevaluates to . In case it evaluates tofalse, the predicate passes.- Type Parameters:
T-- Parameters:
condition- Condition guarding execution of the predicatepredicate- Predicate that gets tested if the condition evaluates totrue- Returns:
-
predicates
public static <T extends JsonWebToken> TokenVerifier.Predicate<? super T>[] predicates(TokenVerifier.Predicate<? super T>... predicate)
-
-