Documentation ¶
Index ¶
- func NewSessionID(n int) (string, error)
- type AuthRepository
- type AuthService
- func (srv *AuthService) AuthenticateSession(ctx context.Context, sessionID string) (User, error)
- func (srv *AuthService) AuthenticateWithPassword(ctx context.Context, creds PasswordCredentials) (User, error)
- func (srv *AuthService) CreateSession(ctx context.Context, user User) (*Session, error)
- func (srv *AuthService) Register(ctx context.Context, creds PasswordCredentials) (User, error)
- type Clock
- type NewAuthServiceParams
- type PasswordCredentials
- type Session
- type User
- type UserWithPassword
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSessionID ¶
Types ¶
type AuthRepository ¶
type AuthRepository interface { GetUserByUsername(ctx context.Context, username string) (UserWithPassword, error) AddUser(ctx context.Context, params UserWithPassword) error GetSession(ctx context.Context, sessionID string) (Session, error) CreateSession(ctx context.Context, session Session) error }
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(params NewAuthServiceParams) *AuthService
func (*AuthService) AuthenticateSession ¶
func (*AuthService) AuthenticateWithPassword ¶
func (srv *AuthService) AuthenticateWithPassword(ctx context.Context, creds PasswordCredentials) (User, error)
func (*AuthService) CreateSession ¶
func (*AuthService) Register ¶
func (srv *AuthService) Register(ctx context.Context, creds PasswordCredentials) (User, error)
type NewAuthServiceParams ¶
type NewAuthServiceParams struct { Repository AuthRepository Clock Clock }
type PasswordCredentials ¶
type Session ¶
type Session struct { ID string User User CreatedAt time.Time RevokedAt time.Time ExpiresAt time.Time LastActiveAt time.Time IsRevoked bool }
func NewSession ¶
type UserWithPassword ¶
Click to show internal directories.
Click to hide internal directories.