auth

package
v0.0.0-...-f356f3c Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClaimExpiredInKey = "exp"
	ClaimIssuedAtKey  = "iat"
	ClaimUserKey      = "user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginData

type LoginData struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

LoginData is the input JSON body captured from the login request

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service prepares the interfaces related with this auth service

func NewService

func NewService(log *logger.Logger, jwtExpTime int, tokenAuth *jwtauth.JWTAuth) *Service

NewService creates a new auth service

func (*Service) Authorize

func (svc *Service) Authorize(loginData LoginData) (*Token, error)

Authorize authorizes user credential

type Token

type Token struct {
	AccessToken string          `json:"access_token"`
	ExpiredIn   int64           `json:"expired_in"`
	IssuedAt    int64           `json:"issued_at"`
	Session     session.Session `json:"session"`
}

Jump to

Keyboard shortcuts

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