auth

package
v0.0.0-...-1422b68 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceCode = "73"
	GrantType   = "client_credentials"
	TSLayout    = "2006-01-02T15:04:05+07:00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

func NewAuthService

func NewAuthService(cfg *config.EnvParams) *AuthService

func (*AuthService) GetAccessToken

func (a *AuthService) GetAccessToken(w http.ResponseWriter, r *http.Request) (*TokenResponse, *res.Message)

func (*AuthService) ValidateAccessToken

func (a *AuthService) ValidateAccessToken(accessToken string, serviceCode string) *res.Message

type TokenHeader

type TokenHeader struct {
	ContentType string `header:"Content-Type" validate:"required"`
	ClientKey   string `header:"X-Client-Key" validate:"required,max=64"`
	Timestamp   string `header:"X-Timestamp" validate:"required" `
	Signature   string `header:"X-Signature" validate:"required"`
}

time_format:"2006-01-02T15:04:05+07:00"

type TokenRequest

type TokenRequest struct {
	GrantType string `json:"grantType" validate:"required"`
}

type TokenResponse

type TokenResponse struct {
	ResponseCode    string `json:"responseCode"`
	ResponseMessage string `json:"responseMessage"`
	AccessToken     string `json:"accessToken"`
	TokenType       string `json:"tokenType"`
	ExpiresIn       string `json:"expiresIn"`
}

Jump to

Keyboard shortcuts

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