auth

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 21 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 *url.URL,
	cookieDomain *url.URL,
	cookieExpiry 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) 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) LogoutCookie added in v0.0.10

func (s *Service) LogoutCookie(ctx context.Context) (*http.Cookie, error)

func (*Service) ParseAndVerifyESIToken

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

func (*Service) UserCookie added in v0.0.10

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