Documentation
¶
Index ¶
- Variables
- type CheckPasswordFunc
- type Credentials
- type EnrichClaimsFunc
- type Logger
- type Meta
- type MetaOption
- type RefreshSession
- type Service
- type ServiceConfig
- type ServiceOption
- func WithAccessTokenTTL(d time.Duration) ServiceOption
- func WithCheckPassword(fn CheckPasswordFunc) ServiceOption
- func WithEnrichClaims(fn EnrichClaimsFunc) ServiceOption
- func WithIssuer(iss string) ServiceOption
- func WithLogger(logger Logger) ServiceOption
- func WithRefreshTokenTTL(d time.Duration) ServiceOption
- func WithSignedKey(key any) ServiceOption
- type Session
- type SessionStorage
- type TokenPair
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CheckPasswordFunc ¶
type Credentials ¶
type EnrichClaimsFunc ¶
type RefreshSession ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(storage SessionStorage, opts ...ServiceOption) *Service
func (*Service) Login ¶
func (s *Service) Login(ctx context.Context, cred Credentials, opts ...MetaOption) (TokenPair, error)
func (*Service) RefreshSession ¶
func (s *Service) RefreshSession(ctx context.Context, rs RefreshSession, opts ...MetaOption) (TokenPair, error)
type ServiceConfig ¶
type ServiceConfig struct {
AccessTokenTTL time.Duration
RefreshTokenTTL time.Duration
Issuer string
SignedKey any
CheckPassword CheckPasswordFunc
EnrichClaims EnrichClaimsFunc
Logger Logger
}
type ServiceOption ¶
type ServiceOption func(conf *ServiceConfig)
func WithAccessTokenTTL ¶
func WithAccessTokenTTL(d time.Duration) ServiceOption
func WithCheckPassword ¶
func WithCheckPassword(fn CheckPasswordFunc) ServiceOption
func WithEnrichClaims ¶
func WithEnrichClaims(fn EnrichClaimsFunc) ServiceOption
func WithIssuer ¶
func WithIssuer(iss string) ServiceOption
func WithLogger ¶
func WithLogger(logger Logger) ServiceOption
func WithRefreshTokenTTL ¶
func WithRefreshTokenTTL(d time.Duration) ServiceOption
func WithSignedKey ¶
func WithSignedKey(key any) ServiceOption
type SessionStorage ¶
Click to show internal directories.
Click to hide internal directories.