xjwt

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 1 Imported by: 0

README

xjwt

Dependencies

  • github.com/Aoi-hosizora/ahlib
  • github.com/dgrijalva/jwt-go

Documents

Types
  • None
Variables
  • None
Constants
  • None
Functions
  • func GenerateToken(method jwt.SigningMethod, claims jwt.Claims, key interface{}) (string, error)
  • func GenerateTokenWithHS256(claims jwt.Claims, secret []byte) (string, error)
  • func GenerateTokenWithHS384(claims jwt.Claims, secret []byte) (string, error)
  • func GenerateTokenWithHS512(claims jwt.Claims, secret []byte) (string, error)
  • func ParseToken(signedToken string, secret []byte, claims jwt.Claims) (*jwt.Token, error)
  • func ParseTokenClaims(signedToken string, secret []byte, claims jwt.Claims) (jwt.Claims, error)
  • func CheckValidationError(err error, flag uint32) bool
  • func IsAudienceError(err error) bool
  • func IsExpiredError(err error) bool
  • func IsIdError(err error) bool
  • func IsIssuedAtError(err error) bool
  • func IsIssuerError(err error) bool
  • func IsNotValidYetError(err error) bool
  • func IsTokenInvalidError(err error) bool
  • func IsClaimsInvalidError(err error) bool
Methods
  • None

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckValidationError added in v1.5.0

func CheckValidationError(err error, flag uint32) bool

CheckValidationError returns true if given error is jwt.ValidationError with given flag.

func GenerateToken

func GenerateToken(method jwt.SigningMethod, claims jwt.Claims, key interface{}) (string, error)

GenerateToken generates token using given jwt.Claims, secret and jwt.SigningMethod.

func GenerateTokenWithHS256 added in v1.5.0

func GenerateTokenWithHS256(claims jwt.Claims, secret []byte) (string, error)

GenerateTokenWithHS256 generates token using given jwt.Claims, secret and HS256 (HMAC SHA256) signing method.

func GenerateTokenWithHS384 added in v1.5.0

func GenerateTokenWithHS384(claims jwt.Claims, secret []byte) (string, error)

GenerateTokenWithHS384 generates token using given jwt.Claims, secret and HS384 (HMAC SHA384) signing method.

func GenerateTokenWithHS512 added in v1.5.0

func GenerateTokenWithHS512(claims jwt.Claims, secret []byte) (string, error)

GenerateTokenWithHS512 generates token using given jwt.Claims, secret and HS512 (HMAC SHA512) signing method.

func IsAudienceError added in v1.5.0

func IsAudienceError(err error) bool

IsAudienceError checks error is an AUD (Audience) validation error.

func IsClaimsInvalidError added in v1.5.0

func IsClaimsInvalidError(err error) bool

IsClaimsInvalidError checks error is a generic claims validation error.

func IsExpiredError added in v1.5.0

func IsExpiredError(err error) bool

IsExpiredError checks error is an EXP (Expires at) validation error.

func IsIdError added in v1.5.0

func IsIdError(err error) bool

IsIdError checks error is a JTI (Id) validation error.

func IsIssuedAtError added in v1.5.0

func IsIssuedAtError(err error) bool

IsIssuedAtError checks error is an IAT (Issued at) validation error.

func IsIssuerError added in v1.5.0

func IsIssuerError(err error) bool

IsIssuerError checks error is an ISS (Issuer) validation error.

func IsNotValidYetError added in v1.5.0

func IsNotValidYetError(err error) bool

IsNotValidYetError checks error is a NBF (Not before) validation error.

func IsTokenInvalidError added in v1.5.0

func IsTokenInvalidError(err error) bool

IsTokenInvalidError checks error is an invalid token (could not be parsed) error.

func ParseToken

func ParseToken(signedToken string, secret []byte, claims jwt.Claims) (*jwt.Token, error)

ParseToken parses jwt token string using given custom jwt.Claims and returns jwt.Token.

func ParseTokenClaims added in v1.5.0

func ParseTokenClaims(signedToken string, secret []byte, claims jwt.Claims) (jwt.Claims, error)

ParseTokenClaims parses jwt token string using given custom jwt.Claims and returns jwt.Claims.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL