auth

package
v0.0.0-...-25e8c23 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BearerSchema = "Bearer "
	BasicSchema  = "Basic "
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	//Login should return an authorization and refresh token to the client
	Login(w http.ResponseWriter, r *http.Request)
	//Logout should clear/invalidate the authorization and refresh tokens
	Logout(w http.ResponseWriter, r *http.Request)
	//Register should create a new user
	Register(w http.ResponseWriter, r *http.Request)
	//RefreshToken receives the refresh token from the client, validates it, removes it and returns a new authorization and refresh token
	RefreshToken(w http.ResponseWriter, r *http.Request)
}

Authenticator is an interface that describes the functionality for authenticating http functions

type DefaultClient

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

func NewDefaultClient

func NewDefaultClient(key []byte, authorizationTokenExpiration time.Duration, refreshTokenExpiration time.Duration, adminEnabled bool, isAllowedAnonymous map[string]bool) *DefaultClient

NewDefaultClient

func (*DefaultClient) AuthorizationMiddleware

func (c *DefaultClient) AuthorizationMiddleware(next http.Handler) http.Handler

func (*DefaultClient) Login

func (c *DefaultClient) Login(w http.ResponseWriter, r *http.Request)

func (*DefaultClient) Logout

func (c *DefaultClient) Logout(w http.ResponseWriter, r *http.Request)

func (*DefaultClient) RefreshToken

func (c *DefaultClient) RefreshToken(w http.ResponseWriter, r *http.Request)

func (*DefaultClient) Register

func (c *DefaultClient) Register(w http.ResponseWriter, r *http.Request)

type TokenExchanger

type TokenExchanger interface {
	ExchangeToken(r *http.Request) (models.Claims, error)
}

TokenExchanger is an interface that describes how an oauth token should be exchanged to our own claims

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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