Class JwtDirectives


  • public abstract class JwtDirectives
    extends java.lang.Object
    JwtDirectives provides utilities to easily assert and extract claims from a JSON Web Token (JWT).

    For more information about JWTs, see {@link https://jwt.io/} or consult RFC 7519: {@link https://datatracker.ietf.org/doc/html/rfc7519}

    • Constructor Summary

      Constructors 
      Constructor Description
      JwtDirectives()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Route jwt​(JwtSettings settings, java.util.function.Function<JwtClaims,​Route> inner)
      Wraps its inner route with support for the JWT mechanism, enabling JWT token validation using the given jwt settings.
      Route jwt​(java.util.function.Function<JwtClaims,​Route> inner)
      Wraps its inner route with support for the JWT mechanism, enabling JWT token validation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JwtDirectives

        public JwtDirectives()
    • Method Detail

      • jwt

        public Route jwt​(java.util.function.Function<JwtClaims,​Route> inner)
        Wraps its inner route with support for the JWT mechanism, enabling JWT token validation. JWT token validation is done automatically extracting the token from the Authorization header. If the token is valid, the inner route is executed and provided the set of claims as JwtClaims, otherwise a 401 Unauthorized response is returned.
        Parameters:
        inner - (undocumented)
        Returns:
        (undocumented)
      • jwt

        public Route jwt​(JwtSettings settings,
                         java.util.function.Function<JwtClaims,​Route> inner)
        Wraps its inner route with support for the JWT mechanism, enabling JWT token validation using the given jwt settings. JWT token validation is done automatically extracting the token from the Authorization header. If the token is valid, the inner route is executed and provided the set of claims as JwtClaims, otherwise a 401 Unauthorized response is returned.
        Parameters:
        settings - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)