auth

package
v0.0.0-...-a7e6680 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const APITokenLifeSpan = 31536000
View Source
const AccessTokenLifeSpan = 36000
View Source
const RefreshTokenLifeSpan = 864000

Variables

This section is empty.

Functions

This section is empty.

Types

type APITokenResponse

type APITokenResponse struct {
	ExpiresIn int64  `json:"expiresIn"`
	APIToken  string `json:"apiToken" sql:"-"`
}

func CreateAPIToken

func CreateAPIToken(userID int64) (*APITokenResponse, error)

type JSONWebToken

type JSONWebToken struct {
	UserID int64 `json:"userID"`
	jwt.StandardClaims
}

type RefreshJWTReq

type RefreshJWTReq struct {
	GrantType    string `json:"grantType" sql:"-"`
	RefreshToken string `json:"refreshToken" sql:"-"`
}

type TokenResponse

type TokenResponse struct {
	ExpiresIn    int64  `json:"expiresIn"`
	AccessToken  string `json:"accessToken" sql:"-"`
	RefreshToken string `json:"refreshToken" sql:"-"`
}

func CreateToken

func CreateToken(userID int64) (*TokenResponse, error)

func RefreshToken

func RefreshToken(rawToken string) (*TokenResponse, error)

Jump to

Keyboard shortcuts

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