Module bus.auth

Class JWTHeader

java.lang.Object
org.miaixz.bus.auth.metric.jwt.Claims
org.miaixz.bus.auth.metric.jwt.JWTHeader
All Implemented Interfaces:
Serializable

public class JWTHeader extends Claims
JWT头部信息
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Field Details

    • ALGORITHM

      public static String ALGORITHM
      加密算法,通常为HMAC SHA256(HS256)
    • TYPE

      public static String TYPE
      声明类型,一般为jwt
    • CONTENT_TYPE

      public static String CONTENT_TYPE
      内容类型(content type)
    • KEY_ID

      public static String KEY_ID
      jwk的ID编号
  • Constructor Details

    • JWTHeader

      public JWTHeader()
  • Method Details

    • setAlgorithm

      public JWTHeader setAlgorithm(String algorithm)
      增加“alg”头信息
      Parameters:
      algorithm - 算法ID,如HS265
      Returns:
      this
    • setType

      public JWTHeader setType(String type)
      增加“typ”头信息
      Parameters:
      type - 类型,如JWT
      Returns:
      this
    • setContentType

      public JWTHeader setContentType(String contentType)
      增加“cty”头信息
      Parameters:
      contentType - 内容类型
      Returns:
      this
    • setKeyId

      public JWTHeader setKeyId(String keyId)
      增加“kid”头信息
      Parameters:
      keyId - kid
      Returns:
      this
    • addHeaders

      public JWTHeader addHeaders(Map<String,?> headerClaims)
      增加自定义JWT认证头
      Parameters:
      headerClaims - 头信息
      Returns:
      this