Documentation
¶
Index ¶
- Constants
- type AuthenticationResponse
- type AuthenticationResult
- type Handler
- func (h *Handler) LoginHandler(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) RefreshTokenHandler(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) RegisterHandler(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) RevokeTokenHandler(w http.ResponseWriter, r *http.Request) error
- type LoginRequest
- type RegisterRequest
- type Service
- func (s *Service) Login(ctx context.Context, req LoginRequest) (*AuthenticationResult, error)
- func (s *Service) RefreshToken(ctx context.Context, token string) (*AuthenticationResult, error)
- func (s *Service) Register(ctx context.Context, req RegisterRequest) (*AuthenticationResult, error)
- func (s *Service) RevokeToken(ctx context.Context, token string) error
Constants ¶
View Source
const (
TimeDay = time.Hour * 24
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationResponse ¶
type AuthenticationResponse struct {
ID uuid.UUID `json:"id,omitempty"`
AccessToken *jwt.AccessToken `json:"accessToken"`
}
type AuthenticationResult ¶
type AuthenticationResult struct {
ID uuid.UUID `json:"id,omitempty"`
AccessToken *jwt.AccessToken `json:"accessToken"`
RefreshToken *repository.RefreshToken `json:"refreshToken"`
}
func (*AuthenticationResult) ToAuthenticationResponse ¶
func (a *AuthenticationResult) ToAuthenticationResponse() *AuthenticationResponse
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) LoginHandler ¶
func (*Handler) RefreshTokenHandler ¶
func (*Handler) RegisterHandler ¶
func (*Handler) RevokeTokenHandler ¶
type LoginRequest ¶
type RegisterRequest ¶
type RegisterRequest struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
func (*RegisterRequest) ToRegisterParams ¶
func (r *RegisterRequest) ToRegisterParams() (*repository.RegisterParams, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) Login ¶
func (s *Service) Login(ctx context.Context, req LoginRequest) (*AuthenticationResult, error)
func (*Service) RefreshToken ¶
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, req RegisterRequest) (*AuthenticationResult, error)
Click to show internal directories.
Click to hide internal directories.