Documentation
¶
Index ¶
- Variables
- func FormatUserCode(code string) string
- type DeviceService
- func (s *DeviceService) AuthorizeDeviceCode(userCode, userID string) error
- func (s *DeviceService) GenerateDeviceCode(clientID, scope string) (*models.DeviceCode, error)
- func (s *DeviceService) GetClientNameByUserCode(userCode string) (string, error)
- func (s *DeviceService) GetDeviceCode(deviceCode string) (*models.DeviceCode, error)
- func (s *DeviceService) GetDeviceCodeByUserCode(userCode string) (*models.DeviceCode, error)
- type JWTClaims
- type TokenService
- type UserService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidClient = errors.New("invalid client_id") ErrDeviceCodeNotFound = errors.New("device code not found") ErrDeviceCodeExpired = errors.New("device code expired") ErrUserCodeNotFound = errors.New("user code not found") )
View Source
var ( ErrAuthorizationPending = errors.New("authorization_pending") ErrSlowDown = errors.New("slow_down") ErrAccessDenied = errors.New("access_denied") ErrExpiredToken = errors.New("expired_token") )
View Source
var ( ErrInvalidCredentials = errors.New("invalid username or password") ErrUserNotFound = errors.New("user not found") )
Functions ¶
func FormatUserCode ¶
FormatUserCode formats a user code for display (e.g., "ABCDEFGH" -> "ABCD-EFGH")
Types ¶
type DeviceService ¶
type DeviceService struct {
// contains filtered or unexported fields
}
func NewDeviceService ¶
func NewDeviceService(s *store.Store, cfg *config.Config) *DeviceService
func (*DeviceService) AuthorizeDeviceCode ¶
func (s *DeviceService) AuthorizeDeviceCode(userCode, userID string) error
AuthorizeDeviceCode marks a device code as authorized by a user
func (*DeviceService) GenerateDeviceCode ¶
func (s *DeviceService) GenerateDeviceCode(clientID, scope string) (*models.DeviceCode, error)
GenerateDeviceCode creates a new device code request
func (*DeviceService) GetClientNameByUserCode ¶
func (s *DeviceService) GetClientNameByUserCode(userCode string) (string, error)
GetClientNameByUserCode retrieves the client name associated with a user code
func (*DeviceService) GetDeviceCode ¶
func (s *DeviceService) GetDeviceCode(deviceCode string) (*models.DeviceCode, error)
GetDeviceCode retrieves a device code by its code
func (*DeviceService) GetDeviceCodeByUserCode ¶
func (s *DeviceService) GetDeviceCodeByUserCode(userCode string) (*models.DeviceCode, error)
GetDeviceCodeByUserCode retrieves a device code by user code
type JWTClaims ¶
type JWTClaims struct {
UserID string `json:"user_id"`
ClientID string `json:"client_id"`
Scopes string `json:"scope"`
jwt.RegisteredClaims
}
type TokenService ¶
type TokenService struct {
// contains filtered or unexported fields
}
func NewTokenService ¶
func NewTokenService(s *store.Store, cfg *config.Config) *TokenService
func (*TokenService) ExchangeDeviceCode ¶
func (s *TokenService) ExchangeDeviceCode( deviceCode, clientID string, ) (*models.AccessToken, error)
ExchangeDeviceCode exchanges an authorized device code for an access token
func (*TokenService) ValidateToken ¶
func (s *TokenService) ValidateToken(tokenString string) (*JWTClaims, error)
ValidateToken validates a JWT token and returns the claims
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(s *store.Store) *UserService
func (*UserService) Authenticate ¶
func (s *UserService) Authenticate(username, password string) (*models.User, error)
func (*UserService) GetUserByID ¶
func (s *UserService) GetUserByID(id string) (*models.User, error)
Click to show internal directories.
Click to hide internal directories.