Documentation
¶
Index ¶
- func RetrieveAuthFromContext(ctx context.Context) *domain.ContextAuthInfo
- func SetAuthToContext(ctx context.Context, authInfo domain.ContextAuthInfo) context.Context
- type Option
- func WithJWTAccessTokenTTL(ttl time.Duration) Option
- func WithJWTAudience(audience []string) Option
- func WithJWTIssuer(issuer string) Option
- func WithJWTRefreshTokenTTL(ttl time.Duration) Option
- func WithJWTSecrets(secret []string) Option
- func WithLogger(logger *slog.Logger) Option
- func WithLoginAccountRequests(requests int) Option
- func WithLoginIPRequests(requests int) Option
- func WithLoginWindow(window time.Duration) Option
- func WithMinPasswordEntropyBits(bits int) Option
- func WithRateLimiterEnabled(enabled bool) Option
- func WithRefreshSessionRequests(requests int) Option
- func WithRefreshWindow(window time.Duration) Option
- func WithSignupIPRequests(requests int) Option
- func WithSignupWindow(window time.Duration) Option
- type Service
- func (s *Service) CheckIPLimit(ctx context.Context, action domain.AuthenticationAction, ip string) error
- func (s *Service) CheckPasswordStrength(password string) error
- func (s *Service) CreateUser(ctx context.Context, data *domain.CreateUserData) (*models.User, error)
- func (s *Service) DeleteUser(ctx context.Context, uuid string) error
- func (s *Service) GetUserByID(ctx context.Context, id int) (*models.User, error)
- func (s *Service) GetUserByUUID(ctx context.Context, uuid string) (*models.User, error)
- func (s *Service) ListUsers(ctx context.Context, limit, offset int) ([]*models.User, error)
- func (s *Service) Login(ctx context.Context, email string, password string) (*domain.Tokens, error)
- func (s *Service) Logout(ctx context.Context, refreshToken string) error
- func (s *Service) RecentlyUsedTokensChan() <-chan domain.TokenWasUsed
- func (s *Service) Refresh(ctx context.Context, token string) (*domain.Tokens, error)
- func (s *Service) SignUp(ctx context.Context, email string, password string) (*models.User, error)
- func (s *Service) UpdateSelf(ctx context.Context, uuid string, data *domain.UpdateSelfData) error
- func (s *Service) UpdateUser(ctx context.Context, uuid string, data *domain.UpdateUserData) error
- func (s *Service) ValidateAPIToken(ctx context.Context, token string) (*models.Token, error)
- func (s *Service) ValidateJWTToken(ctx context.Context, token string, expectedPurpose domain.JWTTokenPurpose) (*domain.JWTClaims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RetrieveAuthFromContext ¶
func RetrieveAuthFromContext(ctx context.Context) *domain.ContextAuthInfo
RetrieveAuthFromContext retrieve auth state from context. Returns pointer to copy of data, which can be mutated without side effects.
func SetAuthToContext ¶
SetAuthToContext sets auth state to context.
Types ¶
type Option ¶
type Option func(*Service)
func WithJWTAccessTokenTTL ¶
func WithJWTAudience ¶
func WithJWTIssuer ¶
func WithJWTRefreshTokenTTL ¶
func WithJWTSecrets ¶
func WithLogger ¶
func WithLoginAccountRequests ¶ added in v0.9.79
func WithLoginIPRequests ¶ added in v0.9.79
func WithLoginWindow ¶ added in v0.9.79
func WithRateLimiterEnabled ¶ added in v0.9.79
func WithRefreshSessionRequests ¶ added in v0.9.79
func WithRefreshWindow ¶ added in v0.9.79
func WithSignupIPRequests ¶ added in v0.9.79
func WithSignupWindow ¶ added in v0.9.79
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CheckIPLimit ¶ added in v0.9.79
func (s *Service) CheckIPLimit(ctx context.Context, action domain.AuthenticationAction, ip string) error
CheckIPLimit is called before decoding HTTP credentials. The transport uses its configured trusted-proxy policy to supply the client IP.
func (*Service) CheckPasswordStrength ¶
func (*Service) CreateUser ¶
func (*Service) GetUserByID ¶
func (*Service) GetUserByUUID ¶
func (*Service) RecentlyUsedTokensChan ¶
func (s *Service) RecentlyUsedTokensChan() <-chan domain.TokenWasUsed
func (*Service) UpdateSelf ¶ added in v0.9.79
func (*Service) UpdateUser ¶
func (*Service) ValidateAPIToken ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
adapters
|
|
|
grpc/v1/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
http/v1/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.