Class JwtClaimsSet.Builder

  • Enclosing class:
    JwtClaimsSet

    public static final class JwtClaimsSet.Builder
    extends java.lang.Object
    A builder for JwtClaimsSet.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JwtClaimsSet.Builder audience​(java.util.List<java.lang.String> audience)
      Sets the audience (aud) claim, which identifies the recipient(s) that the JWT is intended for.
      JwtClaimsSet build()
      Builds a new JwtClaimsSet.
      JwtClaimsSet.Builder claim​(java.lang.String name, java.lang.Object value)
      Sets the claim.
      JwtClaimsSet.Builder claims​(java.util.function.Consumer<java.util.Map<java.lang.String,​java.lang.Object>> claimsConsumer)
      A Consumer to be provided access to the claims allowing the ability to add, replace, or remove.
      JwtClaimsSet.Builder expiresAt​(java.time.Instant expiresAt)
      Sets the expiration time (exp) claim, which identifies the time on or after which the JWT MUST NOT be accepted for processing.
      JwtClaimsSet.Builder id​(java.lang.String jti)
      Sets the JWT ID (jti) claim, which provides a unique identifier for the JWT.
      JwtClaimsSet.Builder issuedAt​(java.time.Instant issuedAt)
      Sets the issued at (iat) claim, which identifies the time at which the JWT was issued.
      JwtClaimsSet.Builder issuer​(java.lang.String issuer)
      Sets the issuer (iss) claim, which identifies the principal that issued the JWT.
      JwtClaimsSet.Builder notBefore​(java.time.Instant notBefore)
      Sets the not before (nbf) claim, which identifies the time before which the JWT MUST NOT be accepted for processing.
      JwtClaimsSet.Builder subject​(java.lang.String subject)
      Sets the subject (sub) claim, which identifies the principal that is the subject of the JWT.
      • Methods inherited from class java.lang.Object

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

      • issuer

        public JwtClaimsSet.Builder issuer​(java.lang.String issuer)
        Sets the issuer (iss) claim, which identifies the principal that issued the JWT.
        Parameters:
        issuer - the issuer identifier
        Returns:
        the JwtClaimsSet.Builder
      • subject

        public JwtClaimsSet.Builder subject​(java.lang.String subject)
        Sets the subject (sub) claim, which identifies the principal that is the subject of the JWT.
        Parameters:
        subject - the subject identifier
        Returns:
        the JwtClaimsSet.Builder
      • audience

        public JwtClaimsSet.Builder audience​(java.util.List<java.lang.String> audience)
        Sets the audience (aud) claim, which identifies the recipient(s) that the JWT is intended for.
        Parameters:
        audience - the audience that this JWT is intended for
        Returns:
        the JwtClaimsSet.Builder
      • expiresAt

        public JwtClaimsSet.Builder expiresAt​(java.time.Instant expiresAt)
        Sets the expiration time (exp) claim, which identifies the time on or after which the JWT MUST NOT be accepted for processing.
        Parameters:
        expiresAt - the time on or after which the JWT MUST NOT be accepted for processing
        Returns:
        the JwtClaimsSet.Builder
      • notBefore

        public JwtClaimsSet.Builder notBefore​(java.time.Instant notBefore)
        Sets the not before (nbf) claim, which identifies the time before which the JWT MUST NOT be accepted for processing.
        Parameters:
        notBefore - the time before which the JWT MUST NOT be accepted for processing
        Returns:
        the JwtClaimsSet.Builder
      • issuedAt

        public JwtClaimsSet.Builder issuedAt​(java.time.Instant issuedAt)
        Sets the issued at (iat) claim, which identifies the time at which the JWT was issued.
        Parameters:
        issuedAt - the time at which the JWT was issued
        Returns:
        the JwtClaimsSet.Builder
      • id

        public JwtClaimsSet.Builder id​(java.lang.String jti)
        Sets the JWT ID (jti) claim, which provides a unique identifier for the JWT.
        Parameters:
        jti - the unique identifier for the JWT
        Returns:
        the JwtClaimsSet.Builder
      • claim

        public JwtClaimsSet.Builder claim​(java.lang.String name,
                                          java.lang.Object value)
        Sets the claim.
        Parameters:
        name - the claim name
        value - the claim value
        Returns:
        the JwtClaimsSet.Builder
      • claims

        public JwtClaimsSet.Builder claims​(java.util.function.Consumer<java.util.Map<java.lang.String,​java.lang.Object>> claimsConsumer)
        A Consumer to be provided access to the claims allowing the ability to add, replace, or remove.
        Parameters:
        claimsConsumer - a Consumer of the claims