auth

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 19 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 {
	// contains filtered or unexported methods
}

type Service

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

func New

func New(
	client *http.Client, cache cache.AuthAPI,
	esiOAuth *oauth2.Config, userPrivateKey *rsa.PrivateKey,
	esiAuthJWKSEndpoint string,
	userTokenExpiry time.Duration,
) *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) CookieForUserID

func (s *Service) CookieForUserID(ctx context.Context, cookie *http.Cookie, userID uuid.UUID) (*http.Cookie, error)

func (*Service) DeleteAuthAttempt

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

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) UserIDFromCookie

func (s *Service) UserIDFromCookie(ctx context.Context, cookie *http.Cookie) (uuid.UUID, 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