authn

package
v1.0.4-gitspaces-beta Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoAuthData that is returned if the authorizer doesn't find any data in the request that can be used for auth.
	ErrNoAuthData = errors.New("the request doesn't contain any auth data that can be used by the Authorizer")
)

WireSet provides a wire set for this package.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	/*
	 * Tries to authenticate the acting principal if credentials are available.
	 * Returns:
	 *		(session, nil) 		    - request contains auth data and principal was verified
	 *		(nil, ErrNoAuthData)	- request doesn't contain any auth data
	 *		(nil, err)  			- request contains auth data but verification failed
	 */
	Authenticate(r *http.Request) (*auth.Session, error)
}

Authenticator is an abstraction of an entity that's responsible for authenticating principals that are making calls via HTTP.

func ProvideAuthenticator

func ProvideAuthenticator(
	config *types.Config,
	principalStore store.PrincipalStore,
	tokenStore store.TokenStore,
) Authenticator

type JWTAuthenticator

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

JWTAuthenticator uses the provided JWT to authenticate the caller.

func NewTokenAuthenticator

func NewTokenAuthenticator(
	principalStore store.PrincipalStore,
	tokenStore store.TokenStore,
	cookieName string,
) *JWTAuthenticator

func (*JWTAuthenticator) Authenticate

func (a *JWTAuthenticator) Authenticate(r *http.Request) (*auth.Session, error)

Jump to

Keyboard shortcuts

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