signoptions

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

signoptions 签名器签名方法的参数

Index

Constants

This section is empty.

Variables

View Source
var DefaultSignOptions = SignOptions{}

Functions

func AddAud

func AddAud(aud string) optparams.Option[SignOptions]

AddAud 设置接收jwt的一方标识,即访问权限的所有方,比如`b.com`

func WillEffectiveAfter

func WillEffectiveAfter(nbftime time.Duration) optparams.Option[SignOptions]

WillEffectiveAfter 设置jwt开始时间,从调用时间起过多久开始生效

func WillEffectiveOn

func WillEffectiveOn(nbf time.Time) optparams.Option[SignOptions]

WillEffectiveOn 设置jwt的生效开始时间

func WithAud

func WithAud(aud ...string) optparams.Option[SignOptions]

WithAud 设置接收jwt的一方标识,即访问权限的所有方,比如`b.com`

func WithExpAt

func WithExpAt(exp time.Time) optparams.Option[SignOptions]

WithExpAt 设置jwt的有效期截止时间

func WithJTI

func WithJTI(jti string) optparams.Option[SignOptions]

WithJTI 设置jwt的jti,不设置则会使用默认生成器创建

func WithNbf

func WithNbf(nbf int64) optparams.Option[SignOptions]

WithNbf 设置jwt的生效开始时间

func WithRefreshExpAt

func WithRefreshExpAt(exp time.Time) optparams.Option[SignOptions]

WithRefreshExpAt 设置jwt的伴生refreshtoken有效期截止时间

func WithRefreshTTL

func WithRefreshTTL(ttl time.Duration) optparams.Option[SignOptions]

WithRefreshTTL 设置jwt的伴生refreshtoken的生命周期

func WithSub

func WithSub(sub string) optparams.Option[SignOptions]

WithSub 设置jwt所面向的用户,即它的所有人

func WithTTL

WithTTL 设置jwt的生命周期

Types

type SignOptions

type SignOptions struct {
	Sub        string
	Aud        []string
	Exp        int64 // 过期时间戳
	Nbf        int64
	Jti        string
	RefreshExp int64 // >0时会设置refresh_token,其过期时间就是这个字段控制,这个字段也是时间戳
}

SignOptions 签名函数参数

Jump to

Keyboard shortcuts

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