authentication

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("Unauthorized")

ErrUnauthorized API no auth error

Functions

func New

func New(adapter adapters.Http, clientId, clientSecret string) *authService

New returns an auth service implementation

Types

type AuthMock

type AuthMock struct {
	mock.Mock
}

AuthMock mock of auth service

func (*AuthMock) Authenticate

func (a *AuthMock) Authenticate(user, pass string) (c *Credentials, err error)

Authenticate mock of auth service

func (*AuthMock) GetToken

func (a *AuthMock) GetToken() (token string)

GetToken mock of auth service

func (*AuthMock) Validate

func (a *AuthMock) Validate() (err error)

Validate mock of auth service

type Credentials

type Credentials struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
}

Credentials describes the API credential type

type Service

type Service interface {
	Authenticate(username, password string) (*Credentials, error)
	Validate() error
	GetToken() string
}

Service describes the auth service abstraction

Jump to

Keyboard shortcuts

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