org.keycloak.authentication.actiontoken

## Class TokenUtils

- java.lang.Object
- - org.keycloak.authentication.actiontoken.TokenUtils

-     public class TokenUtils
      extends Object

  Author:
    hmlnarik

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TokenVerifier.Predicate<JsonWebToken>` | `checkThat(BooleanSupplier function, String errorEvent, String errorMessage)` Returns a predicate for use in `TokenVerifier` using 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 in `TokenVerifier` 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 given `condition` evaluates to .
    `static <T extends JsonWebToken> TokenVerifier.Predicate<? super T>[]` | `predicates(TokenVerifier.Predicate<? super T>... predicate)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TokenUtils

          public TokenUtils()

  - ### Method Detail

    - #### checkThat

          public static TokenVerifier.Predicate<JsonWebToken> checkThat(BooleanSupplier function,
                                                                        String errorEvent,
                                                                        String errorMessage)

      Returns a predicate for use in `TokenVerifier` using the given boolean-returning function. When the function return `false`, this predicate throws a `ExplainedTokenVerificationException` with `message` and `errorEvent` set from `errorMessage` and `errorEvent`, .
      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 in `TokenVerifier` using the given boolean-returning function. When the function return `false`, this predicate throws a `ExplainedTokenVerificationException` with `message` and `errorEvent` set from `errorMessage` and `errorEvent`, .
      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 given `condition` evaluates to . In case it evaluates to `false`, the predicate passes.
      Type Parameters:
        `T` -
      Parameters:
        `condition` - Condition guarding execution of the predicate
        `predicate` - Predicate that gets tested if the condition evaluates to `true`
      Returns:

    - #### predicates

          public static <T extends JsonWebToken> TokenVerifier.Predicate<? super T>[] predicates(TokenVerifier.Predicate<? super T>... predicate)

Copyright © 2020 JBoss by Red Hat. All rights reserved.