Class JJwt

java.lang.Object
icu.easyj.jwt.impls.JJwt
All Implemented Interfaces:
IJwt, IJwtBuilder, IJwtParser

@LoadLevel(name="jjwt", order=0) public class JJwt extends Object implements IJwt
基于jjwt实现的JWT生成器
Author:
wangliang181230
  • Constructor Details

    • JJwt

      public JJwt(io.jsonwebtoken.SignatureAlgorithm signatureAlgorithm, Key secretKey)
    • JJwt

      public JJwt(io.jsonwebtoken.SignatureAlgorithm signatureAlgorithm, String secretKeyStr, String secretKeyAlgorithm)
    • JJwt

      public JJwt(String signatureAlgorithmStr, String secretKeyStr, String secretKeyAlgorithm)
  • Method Details

    • create

      public String create(String jwtId, Map<String,Object> claims, Date issuedAt, Date expiresAt)
      Description copied from interface: IJwtBuilder
      创建JWT
      Specified by:
      create in interface IJwtBuilder
      Parameters:
      jwtId - JWT的ID
      claims - 私有声明
      issuedAt - 签发时间
      expiresAt - 过期时间,不能小于等于签发时间,为空时表示永久有效
      Returns:
      jwt 返回创建的JWT
    • parse

      public JwtInfo parse(String jwtStr, long leeway)
      Description copied from interface: IJwtParser
      解析JWT
      Specified by:
      parse in interface IJwtParser
      Parameters:
      jwtStr - JWT串
      leeway - 容忍空间,单位:秒。当不能晚于当前时间时,向后容忍;不能早于向前容忍。
      Returns:
      jwtInfo 返回解析出的JWT信息