service

package
v0.0.0-...-93c2bfc Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

func NewAuthService

func NewAuthService(logger logger.Logger, storage AuthStorage, cache *cache.Cache, oauthCfg *oauth2.Config, sgnKey string) *AuthService

func (*AuthService) GenerateAuthURL

func (s *AuthService) GenerateAuthURL() string

func (*AuthService) GetTokens

func (s *AuthService) GetTokens(ctx context.Context, code, state string, jwks json.RawMessage) (*model.TokenPair, error)

func (*AuthService) ParseAccessToken

func (s *AuthService) ParseAccessToken(signed string) (*model.NewellaJWTToken, error)

func (*AuthService) RefreshTokens

func (s *AuthService) RefreshTokens(ctx context.Context, tokenPair model.TokenPair, jwks json.RawMessage) (*model.TokenPair, error)

func (*AuthService) RemoveTokens

func (s *AuthService) RemoveTokens(ctx context.Context, userID string) error

func (*AuthService) VerifyState

func (s *AuthService) VerifyState(state string) bool

type AuthStorage

type AuthStorage interface {
	SaveUser(ctx context.Context, oauthJWT model.OAuthJWTToken, pair model.TokenPair) (string, error)
	GetTokensPair(ctx context.Context, refreshToken, userID string) (*model.TokenPair, error)
	UpdateTokens(ctx context.Context, pair model.TokenPair, userID string) error
	RemoveTokens(ctx context.Context, userID string) error
}

Jump to

Keyboard shortcuts

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