auth

package
v0.0.0-...-8dc6894 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidParameters = iota
	ErrInvalidCredentials
	ErrMissingToken
	ErrInvalidToken
	ErrDecryptionToken
	ErrInsufficientRights
	ErrRegistrationError
	ErrCreatingToken
)

Variables

View Source
var (
	ContextKeyClaims = ContextKey("auth-claims")
)

Functions

func ObtainClaimsFromContext

func ObtainClaimsFromContext(ctx context.Context) *kutil.AppClaims

func ObtainClaimsFromMetadata

func ObtainClaimsFromMetadata(ctx context.Context) (claims *kutil.AppClaims, err error)

Types

type AuthError

type AuthError struct {
	Reason AuthErrorReason
	Err    error
}

AuthError containing error reason and golang's err

func (AuthError) Error

func (err AuthError) Error() string

type AuthErrorReason

type AuthErrorReason int

type AuthnRepo

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

func NewAuthnRepo

func NewAuthnRepo(signingKey kutil.Signer, datastore store.Storer) *AuthnRepo

func (*AuthnRepo) NewClaim

func (a *AuthnRepo) NewClaim(cid, uid, iss, role string, aud []string, dur time.Duration) (string, error)

NewClaim takes ClientID, UserID, Issuer, Audience (scopes), and Duration for expiry

func (*AuthnRepo) VerifyGetUser

func (a *AuthnRepo) VerifyGetUser(id string) (*store.User, error)

VerifyGetUser Verifies user and password, then move on

type ContextKey

type ContextKey string

func (ContextKey) String

func (c ContextKey) String() string

Jump to

Keyboard shortcuts

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