Documentation ¶
Index ¶
Constants ¶
View Source
const ( JWTBearerFormat = 2 Access jwtType = "access" Refresh jwtType = "refresh" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWTCustomClaims ¶
type JWTCustomClaims struct { UserName string `json:"username"` jwt.RegisteredClaims }
type LoginRequest ¶
type LoginRequest struct { Username string `json:"username" validate:"required"` Password string `json:"password" validate:"required"` }
http request struct.
type RefreshTokenRequest ¶
type Service ¶
type Service interface { // authenticate authenticates a user using username and password. // It returns a JWT token if authentication succeeds. Otherwise, an error is returned. Login(ctx context.Context, req LoginRequest) (loginResponse, error) Refresh(ctx context.Context, req RefreshTokenRequest) (refreshResponse, error) }
Service encapsulates the authentication logic.
Click to show internal directories.
Click to hide internal directories.