Documentation ¶
Overview ¶
https://pascalallen.medium.com/jwt-authentication-with-go-242215a9b4f8
litter-go backend
Index ¶
- Variables
- func DumpAll()
- func GetGravatarURL(emailInput string) string
- func LoadAPIRouter() chi.Router
- func LoadAll()
- func NewAccessToken(claims UserClaims, secret string) (string, error)
- func NewRefreshToken(claims jwt.StandardClaims, secret string) (string, error)
- func ParseRefreshToken(refreshToken string, secret string) *jwt.StandardClaims
- func RunMigrations() bool
- type Logger
- type RefreshToken
- type UserAuth
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetGravatarURL ¶ added in v0.16.6
GetGravatarURL function returns the avatar image location/URL, or it defaults to a app logo.
func NewAccessToken ¶ added in v0.23.5
func NewAccessToken(claims UserClaims, secret string) (string, error)
func NewRefreshToken ¶ added in v0.23.5
func NewRefreshToken(claims jwt.StandardClaims, secret string) (string, error)
func ParseRefreshToken ¶ added in v0.23.5
func ParseRefreshToken(refreshToken string, secret string) *jwt.StandardClaims
func RunMigrations ¶ added in v0.16.0
func RunMigrations() bool
RunMigrations is a "wrapper" function for the migration registration and execution
Types ¶
type Logger ¶ added in v0.18.8
type Logger struct { // CallerID is a nickname of the user calling the API. CallerID string `json:"caller_id" validation:"required"` // Code integer is a HTTP return code. Code int `json:"code" validation:"required"` // IPAddress string is basically an user's IPv4/IPv6 address (beware of proxies). IPAddress string `json:"ip_address"` // Message string holds a custom message returned by a various HTTP handler. Message string `json:"message" validation:"required"` // Method string hold a HTTP method name. Method string `json:"method"` // Route string is the very route called by user. Route string `json:"route"` // Time property hold the actual time of the request processing. Time time.Time `json:"time" validation:"required"` // Version is the tagged version of the client's SW (compiled in). Version string `json:"version"` // WorkerName string is the name of a worker processing such request. WorkerName string `json:"worker_name" validation:"required"` }
type RefreshToken ¶ added in v0.24.0
type RefreshToken string
type UserClaims ¶ added in v0.23.5
type UserClaims struct { Nickname string `json:"nickname"` User models.User `json:"user"` jwt.StandardClaims }
func ParseAccessToken ¶ added in v0.23.5
func ParseAccessToken(accessToken string, secret string) *UserClaims
Click to show internal directories.
Click to hide internal directories.