auth

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetPublicJWKSet() string
	GetJWKSURI() string
	// contains filtered or unexported methods
}

type Service

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

func New

func New(
	env skillz.Environment,
	client *http.Client,
	cache cache.AuthAPI,
	esiOAuth *oauth2.Config,
	userPrivateKey *rsa.PrivateKey,
	tokenKid uuid.UUID,
	tokenDomain string,
	tokenExpiry time.Duration,
	esiAuthJWKSEndpoint *url.URL,
) *Service

func (*Service) AuthAttempt

func (s *Service) AuthAttempt(ctx context.Context, state string) (*skillz.AuthAttempt, error)

func (*Service) AuthorizationURI

func (s *Service) AuthorizationURI(ctx context.Context, state string) string

func (*Service) BearerForESICode

func (s *Service) BearerForESICode(ctx context.Context, code string) (*oauth2.Token, error)

func (*Service) DeleteAuthAttempt

func (s *Service) DeleteAuthAttempt(ctx context.Context, attempt *skillz.AuthAttempt) error

func (*Service) GetJWKSURI added in v0.0.14

func (s *Service) GetJWKSURI() string

func (*Service) GetPublicJWKSet added in v0.0.14

func (s *Service) GetPublicJWKSet() string

func (*Service) InitializeAttempt

func (s *Service) InitializeAttempt(ctx context.Context) (*skillz.AuthAttempt, error)

func (*Service) ParseAndVerifyESIToken

func (s *Service) ParseAndVerifyESIToken(ctx context.Context, t string) (jwt.Token, error)

func (*Service) UserIDFromToken added in v0.0.14

func (s *Service) UserIDFromToken(ctx context.Context, raw string) (uuid.UUID, error)

func (*Service) UserToken added in v0.0.14

func (s *Service) UserToken(ctx context.Context, userID uuid.UUID) (string, error)

func (*Service) ValidateESITokenForUser

func (s *Service) ValidateESITokenForUser(ctx context.Context, user *skillz.User) (bool, *oauth2.Token, error)

ValidateESITokenForUser takes a user token and, if expired, refreshed it.

Jump to

Keyboard shortcuts

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