Documentation
¶
Index ¶
- Variables
- func GenerateCode() string
- func GenerateRandomString(length int) (string, error)
- func GenerateToken(username string) (string, error)
- func GenerateTokenWithExp(ctx context.Context, username string, expireTime time.Duration) (string, error)
- func GenerateUUID() string
- func GetUsername(token, flag string) (string, error)
- func OutputHTML(w http.ResponseWriter, req *http.Request, filename string)
- func PostWithHeader(url string, header map[string]string, body any) (*http.Response, error)
- func RefreshToken(token string) (string, error)
- func SendEmail(sender, secret, recipient, content, title string) error
- func ShaHashing(in string) string
- type JWTAccessClaims
- type JWTAccessGenerate
Constants ¶
This section is empty.
Variables ¶
View Source
var (
T_cos *cos.Client = connectToTencentCOS()
)
Functions ¶
func GenerateRandomString ¶
Generate random string
func GenerateToken ¶
GenerateToken token expireTime : not set, do this with redis
func GenerateTokenWithExp ¶
func GenerateTokenWithExp(ctx context.Context, username string, expireTime time.Duration) (string, error)
GenerateToken with expireTime
func GetUsername ¶
GetUsername flag: verify token type
func OutputHTML ¶
func OutputHTML(w http.ResponseWriter, req *http.Request, filename string)
func PostWithHeader ¶
func RefreshToken ¶
Types ¶
type JWTAccessClaims ¶
type JWTAccessClaims struct {
jwt.RegisteredClaims
}
JWTAccessClaims jwt claims
func ParseToken ¶
func ParseToken(token string) (*JWTAccessClaims, error)
func (*JWTAccessClaims) Valid ¶
func (a *JWTAccessClaims) Valid() error
type JWTAccessGenerate ¶
type JWTAccessGenerate struct { SignedKeyID string SignedKey []byte SignedMethod jwt.SigningMethod }
JWTAccessGenerate generate the jwt access token
func NewJWTAccessGenerate ¶
func NewJWTAccessGenerate(kid string, key []byte, method jwt.SigningMethod) *JWTAccessGenerate
NewJWTAccessGenerate create to generate the jwt access token instance
Click to show internal directories.
Click to hide internal directories.