Documentation
¶
Index ¶
- Variables
- type APIKeyCreateInput
- type APIKeyHandler
- func (h *APIKeyHandler) CreateAPIKey(w http.ResponseWriter, r *http.Request)
- func (h *APIKeyHandler) DeleteAPIKey(w http.ResponseWriter, r *http.Request)
- func (h *APIKeyHandler) ListAPIKeys(w http.ResponseWriter, r *http.Request)
- func (h *APIKeyHandler) RevokeAPIKey(w http.ResponseWriter, r *http.Request)
- type APIKeyIDInput
- type Auth
- type AuthResponse
- type CallbackInput
- type Claims
- type CreateAPIKeyPayload
- type GeoIP
- type LoginInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthNotEnabled = errors.New("OIDC authentication is not enabled") ErrStateMissing = errors.New("state parameter missing") ErrInvalidState = errors.New("invalid state parameter") ErrAuthCodeMissing = errors.New("authorization code not provided") ErrFailedExchange = errors.New("failed to exchange code for token") ErrNoIDToken = errors.New("no id_token field in oauth2 token") ErrFailedVerify = errors.New("failed to verify ID token") ErrFailedClaims = errors.New("failed to extract user claims") ErrNoAuthCode = errors.New("no authorization code found") ErrMissingUserInfo = errors.New("missing user info") )
Functions ¶
This section is empty.
Types ¶
type APIKeyCreateInput ¶
type APIKeyCreateInput struct {
Payload *CreateAPIKeyPayload `in:"body=json"`
}
type APIKeyHandler ¶
type APIKeyHandler struct {
// contains filtered or unexported fields
}
func NewAPIKeyHandler ¶
func NewAPIKeyHandler(db *gorm.DB) *APIKeyHandler
func (*APIKeyHandler) CreateAPIKey ¶
func (h *APIKeyHandler) CreateAPIKey(w http.ResponseWriter, r *http.Request)
CreateAPIKey creates a new API key.
func (*APIKeyHandler) DeleteAPIKey ¶
func (h *APIKeyHandler) DeleteAPIKey(w http.ResponseWriter, r *http.Request)
DeleteAPIKey deletes an API key.
func (*APIKeyHandler) ListAPIKeys ¶
func (h *APIKeyHandler) ListAPIKeys(w http.ResponseWriter, r *http.Request)
ListAPIKeys lists all API keys for the authenticated user.
func (*APIKeyHandler) RevokeAPIKey ¶
func (h *APIKeyHandler) RevokeAPIKey(w http.ResponseWriter, r *http.Request)
RevokeAPIKey revokes an API key.
type APIKeyIDInput ¶
type APIKeyIDInput struct {
ID string `in:"path=id"`
}
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth represents the authentication handler.
func (*Auth) Callback ¶
func (a *Auth) Callback(w http.ResponseWriter, r *http.Request)
Callback handles the OIDC callback and exchanges code for token.
func (*Auth) Login ¶
func (a *Auth) Login(w http.ResponseWriter, r *http.Request)
Login redirects to the OIDC provider for authentication.
type AuthResponse ¶
type AuthResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Token string `json:"token,omitempty"`
User *users.User `json:"user,omitempty"`
}
AuthResponse represents the authentication response.
type CallbackInput ¶
CallbackInput represents the input for OAuth callback request.
type Claims ¶
type Claims struct {
Sub string `json:"sub"`
Email string `json:"email"`
Name string `json:"name"`
Groups []string `json:"groups,omitempty"` // OIDC groups claim
Exp int64 `json:"exp"` // Expiration time from ID token
}
func (*Claims) GetExpirationTime ¶
func (*Claims) PostProcess ¶
func (c *Claims) PostProcess()
type CreateAPIKeyPayload ¶
type GeoIP ¶
type GeoIP struct {
// contains filtered or unexported fields
}
GeoIP handles GeoIP-related requests.
type LoginInput ¶
type LoginInput struct {
Redirect string `in:"query=redirect"`
}
LoginInput represents the input for login request.
Click to show internal directories.
Click to hide internal directories.