handlers

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionUserID   = "user_id"
	SessionUsername = "username"
)
View Source
const (
	// https://datatracker.ietf.org/doc/html/rfc8628#section-3.4
	GrantTypeDeviceCode = "urn:ietf:params:oauth:grant-type:device_code"
	// https://datatracker.ietf.org/doc/html/rfc6749#section-6
	GrantTypeRefreshToken = "refresh_token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

func NewAuthHandler

func NewAuthHandler(us *services.UserService) *AuthHandler

func (*AuthHandler) Login

func (h *AuthHandler) Login(c *gin.Context)

Login handles the login form submission

func (*AuthHandler) LoginPage

func (h *AuthHandler) LoginPage(c *gin.Context)

LoginPage renders the login page

func (*AuthHandler) LoginPageWithOAuth added in v0.6.0

func (h *AuthHandler) LoginPageWithOAuth(
	c *gin.Context,
	oauthProviders map[string]*auth.OAuthProvider,
)

LoginPageWithOAuth renders the login page with OAuth providers

func (*AuthHandler) Logout

func (h *AuthHandler) Logout(c *gin.Context)

Logout clears the session and redirects to login

type ClientHandler added in v0.2.0

type ClientHandler struct {
	// contains filtered or unexported fields
}

func NewClientHandler added in v0.2.0

func NewClientHandler(cs *services.ClientService) *ClientHandler

func (*ClientHandler) CreateClient added in v0.2.0

func (h *ClientHandler) CreateClient(c *gin.Context)

CreateClient handles the creation of a new OAuth client

func (*ClientHandler) DeleteClient added in v0.2.0

func (h *ClientHandler) DeleteClient(c *gin.Context)

DeleteClient handles deleting an OAuth client

func (*ClientHandler) RegenerateSecret added in v0.2.0

func (h *ClientHandler) RegenerateSecret(c *gin.Context)

RegenerateSecret handles regenerating the client secret

func (*ClientHandler) ShowClientsPage added in v0.2.0

func (h *ClientHandler) ShowClientsPage(c *gin.Context)

ShowClientsPage displays the list of all OAuth clients

func (*ClientHandler) ShowCreateClientPage added in v0.2.0

func (h *ClientHandler) ShowCreateClientPage(c *gin.Context)

ShowCreateClientPage displays the form to create a new client

func (*ClientHandler) ShowEditClientPage added in v0.2.0

func (h *ClientHandler) ShowEditClientPage(c *gin.Context)

ShowEditClientPage displays the form to edit an existing client

func (*ClientHandler) UpdateClient added in v0.2.0

func (h *ClientHandler) UpdateClient(c *gin.Context)

UpdateClient handles updating an existing OAuth client

func (*ClientHandler) ViewClient added in v0.2.0

func (h *ClientHandler) ViewClient(c *gin.Context)

ViewClient displays detailed information about a client

type DeviceHandler

type DeviceHandler struct {
	// contains filtered or unexported fields
}

func NewDeviceHandler

func NewDeviceHandler(
	ds *services.DeviceService,
	us *services.UserService,
	cfg *config.Config,
) *DeviceHandler

func (*DeviceHandler) DeviceCodeRequest

func (h *DeviceHandler) DeviceCodeRequest(c *gin.Context)

DeviceCodeRequest handles POST /oauth/device/code This is called by the CLI to start the device flow

func (*DeviceHandler) DevicePage

func (h *DeviceHandler) DevicePage(c *gin.Context)

DevicePage renders the device code input page

func (*DeviceHandler) DeviceVerify

func (h *DeviceHandler) DeviceVerify(c *gin.Context)

DeviceVerify handles the user code verification and authorization

type OAuthHandler added in v0.6.0

type OAuthHandler struct {
	// contains filtered or unexported fields
}

OAuthHandler handles OAuth authentication

func NewOAuthHandler added in v0.6.0

func NewOAuthHandler(
	providers map[string]*auth.OAuthProvider,
	userService *services.UserService,
	httpClient *http.Client,
) *OAuthHandler

NewOAuthHandler creates a new OAuth handler

func (*OAuthHandler) LoginWithProvider added in v0.6.0

func (h *OAuthHandler) LoginWithProvider(c *gin.Context)

LoginWithProvider redirects user to OAuth provider

func (*OAuthHandler) OAuthCallback added in v0.6.0

func (h *OAuthHandler) OAuthCallback(c *gin.Context)

OAuthCallback handles OAuth provider callback

type SessionHandler added in v0.2.0

type SessionHandler struct {
	// contains filtered or unexported fields
}

func NewSessionHandler added in v0.2.0

func NewSessionHandler(ts *services.TokenService) *SessionHandler

func (*SessionHandler) DisableSession added in v0.4.0

func (h *SessionHandler) DisableSession(c *gin.Context)

DisableSession temporarily disables a specific session by token ID

func (*SessionHandler) EnableSession added in v0.4.0

func (h *SessionHandler) EnableSession(c *gin.Context)

EnableSession re-enables a previously disabled session by token ID

func (*SessionHandler) ListSessions added in v0.2.0

func (h *SessionHandler) ListSessions(c *gin.Context)

ListSessions shows all active sessions (tokens) for the current user

func (*SessionHandler) RevokeAllSessions added in v0.2.0

func (h *SessionHandler) RevokeAllSessions(c *gin.Context)

RevokeAllSessions revokes all sessions for the current user

func (*SessionHandler) RevokeSession added in v0.2.0

func (h *SessionHandler) RevokeSession(c *gin.Context)

RevokeSession revokes a specific session by token ID

type TokenHandler

type TokenHandler struct {
	// contains filtered or unexported fields
}

func NewTokenHandler

func NewTokenHandler(ts *services.TokenService, cfg *config.Config) *TokenHandler

func (*TokenHandler) Revoke added in v0.2.0

func (h *TokenHandler) Revoke(c *gin.Context)

Revoke handles POST /oauth/revoke (RFC 7009) This endpoint allows clients to revoke access tokens

func (*TokenHandler) Token

func (h *TokenHandler) Token(c *gin.Context)

Token handles POST /oauth/token Routes to appropriate grant type handler based on grant_type parameter

func (*TokenHandler) TokenInfo

func (h *TokenHandler) TokenInfo(c *gin.Context)

TokenInfo handles GET /oauth/tokeninfo (optional endpoint to validate tokens)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL