simpleauthservice

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProviderProductionSet provides a new SimpleAuthService for use in production.
	ProviderProductionSet = wire.NewSet(Provide, wire.Bind(new(domain.AuthService), new(*SimpleAuthService)))
)

Functions

This section is empty.

Types

type RefreshTokenReuse

type RefreshTokenReuse struct{}

func NewRefreshTokenReuseError

func NewRefreshTokenReuseError() RefreshTokenReuse

func (RefreshTokenReuse) Error

func (r RefreshTokenReuse) Error() string

type RefreshTokenRevoked

type RefreshTokenRevoked struct{}

func NewRefreshTokenRevokedError

func NewRefreshTokenRevokedError() RefreshTokenRevoked

func (RefreshTokenRevoked) Error

func (r RefreshTokenRevoked) Error() string

type SimpleAuthService

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

SimpleAuthService is an AuthenticationService which authenticates credentials based on a username and password combination. SimpleAuthService issues AuthTokens and RefreshTokens which can be used in combination to persist a session.

func Provide

func Provide(jwtService jwtservice.JWTService, userService domain.UserService, refreshTokenService domain.RefreshTokenService) *SimpleAuthService

Provide returns a new SimpleAuthService configured with the provided JWTService, UserService, and RefreshTokenService.

func (*SimpleAuthService) Authenticate

func (s *SimpleAuthService) Authenticate(auth domain.Auth) (*domain.TokenSet, error)

Authenticate attempts to authenticate the given Auth. If authenticated, returns a TokenSet. Otherwise, an error is returned.

func (*SimpleAuthService) Deauthenticate

func (s *SimpleAuthService) Deauthenticate(token domain.TokenValue) error

Deauthenticate revokes the provided RefreshToken.

func (*SimpleAuthService) GetUserFromAuthToken

func (s *SimpleAuthService) GetUserFromAuthToken(token domain.TokenValue) (*domain.User, error)

GetUserFromAuthToken retrieves the User that the provided Token belongs to.

func (*SimpleAuthService) IsAuthenticated

func (s *SimpleAuthService) IsAuthenticated(token domain.TokenValue) (bool, error)

IsAuthenticated determines whether the given TokenValue is a valid AuthToken.

func (*SimpleAuthService) RefreshToken

func (s *SimpleAuthService) RefreshToken(token domain.TokenValue) (*domain.TokenSet, error)

RefreshToken attempts to refresh a user's auth token provided that the given TokenValue is a valid RefreshToken.

Jump to

Keyboard shortcuts

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