Class TokenUtils
java.lang.Object
org.keycloak.authentication.actiontoken.TokenUtils
- Author:
- hmlnarik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TokenVerifier.Predicate<JsonWebToken>
checkThat
(BooleanSupplier function, String errorEvent, String errorMessage) Returns a predicate for use inTokenVerifier
using the given boolean-returning function.static <T extends JsonWebToken>
TokenVerifier.Predicate<T>Returns a predicate for use inTokenVerifier
using 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 givencondition
evaluates to .static <T extends JsonWebToken>
TokenVerifier.Predicate<? super T>[]predicates
(TokenVerifier.Predicate<? super T>... predicate)
-
Constructor Details
-
TokenUtils
public TokenUtils()
-
-
Method Details
-
checkThat
public static TokenVerifier.Predicate<JsonWebToken> checkThat(BooleanSupplier function, String errorEvent, String errorMessage) Returns a predicate for use inTokenVerifier
using the given boolean-returning function. When the function returnfalse
, this predicate throws aExplainedTokenVerificationException
withmessage
anderrorEvent
set fromerrorMessage
anderrorEvent
, .- 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 inTokenVerifier
using the given boolean-returning function. When the function returnfalse
, this predicate throws aExplainedTokenVerificationException
withmessage
anderrorEvent
set fromerrorMessage
anderrorEvent
, .- 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 givencondition
evaluates 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)
-