Documentation ¶
Index ¶
- Variables
- type RefreshTokenReuse
- type RefreshTokenRevoked
- type SimpleAuthService
- func (s *SimpleAuthService) Authenticate(auth domain.Auth) (*domain.TokenSet, error)
- func (s *SimpleAuthService) Deauthenticate(token domain.TokenValue) error
- func (s *SimpleAuthService) GetUserFromAuthToken(token domain.TokenValue) (*domain.User, error)
- func (s *SimpleAuthService) IsAuthenticated(token domain.TokenValue) (bool, error)
- func (s *SimpleAuthService) RefreshToken(token domain.TokenValue) (*domain.TokenSet, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.