handlers

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionUserID       = middleware.SessionUserID
	SessionUsername     = middleware.SessionUsername
	SessionLastActivity = middleware.SessionLastActivity
	SessionFingerprint  = middleware.SessionFingerprint
)

Session constant aliases for convenience (canonical definitions in middleware package).

View Source
const (
	// Grant type URNs (RFC 6749, RFC 8628)
	GrantTypeDeviceCode        = "urn:ietf:params:oauth:grant-type:device_code"
	GrantTypeDeviceCodeShort   = "device_code"
	GrantTypeRefreshToken      = "refresh_token"
	GrantTypeAuthorizationCode = "authorization_code"
	GrantTypeClientCredentials = "client_credentials"
)

Variables

View Source
var DocsMeta = []docsMetaEntry{
	{Slug: "getting-started", Titles: map[Locale]string{
		LocaleEN:   "Getting Started",
		LocaleZHTW: "開始使用",
	}},
	{Slug: "auth-code-flow", Titles: map[Locale]string{
		LocaleEN:   "Auth Code Flow",
		LocaleZHTW: "授權碼流程",
	}},
	{Slug: "device-flow", Titles: map[Locale]string{
		LocaleEN:   "Device Flow",
		LocaleZHTW: "裝置流程",
	}},
	{Slug: "client-credentials", Titles: map[Locale]string{
		LocaleEN:   "Client Credentials",
		LocaleZHTW: "用戶端憑證",
	}},
	{Slug: "oidc", Titles: map[Locale]string{
		LocaleEN:   "OpenID Connect",
		LocaleZHTW: "OpenID Connect",
	}},
	{Slug: "jwt-verification", Titles: map[Locale]string{
		LocaleEN:   "JWT Verification",
		LocaleZHTW: "JWT 驗證",
	}},
	{Slug: "tokens", Titles: map[Locale]string{
		LocaleEN:   "Tokens & Revocation",
		LocaleZHTW: "Token 與撤銷",
	}},
	{Slug: "errors", Titles: map[Locale]string{
		LocaleEN:   "Errors",
		LocaleZHTW: "錯誤處理",
	}},
}

DocsMeta defines the ordered list of documentation pages and their titles per locale. Exported so locale-parity tests can assert against it.

View Source
var DocsSupportedLocales = []Locale{LocaleEN, LocaleZHTW}

DocsSupportedLocales lists the locales the handler can serve, in the order they should appear in the language switcher (first entry is the default).

Functions

func NavbarDocsEntriesFor(loc Locale) []templates.DocsEntry

NavbarDocsEntriesFor returns the docs dropdown entries for the given locale, falling back to the default locale when the requested one isn't supported.

Types

type AuditHandler

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

AuditHandler handles audit log operations

func NewAuditHandler

func NewAuditHandler(auditService core.AuditLogger) *AuditHandler

NewAuditHandler creates a new audit handler

func (*AuditHandler) ExportAuditLogs

func (h *AuditHandler) ExportAuditLogs(c *gin.Context)

ExportAuditLogs exports audit logs as CSV

func (*AuditHandler) GetAuditLogStats

func (h *AuditHandler) GetAuditLogStats(c *gin.Context)

GetAuditLogStats returns statistics about audit logs

func (*AuditHandler) ListAuditLogs

func (h *AuditHandler) ListAuditLogs(c *gin.Context)

ListAuditLogs retrieves audit logs with pagination and filtering (JSON API)

func (*AuditHandler) ShowAuditLogsPage

func (h *AuditHandler) ShowAuditLogsPage(c *gin.Context)

ShowAuditLogsPage displays the audit logs HTML page

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(
	us *services.UserService,
	cfg *config.Config,
	m core.Recorder,
) *AuthHandler

func (*AuthHandler) Login

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

Login handles the login form submission

func (*AuthHandler) LoginPage

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

LoginPage renders the login page

func (*AuthHandler) LoginPageWithOAuth

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 AuthorizationHandler

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

AuthorizationHandler manages the OAuth 2.0 Authorization Code Flow consent pages and the user's authorized-applications management UI.

func (*AuthorizationHandler) HandleAuthorize

func (h *AuthorizationHandler) HandleAuthorize(c *gin.Context)

HandleAuthorize processes the user's consent decision (POST /oauth/authorize). Requires the user to be logged in and a valid CSRF token.

func (*AuthorizationHandler) ListAuthorizations

func (h *AuthorizationHandler) ListAuthorizations(c *gin.Context)

ListAuthorizations renders the user's authorized applications page (GET /account/authorizations).

func (*AuthorizationHandler) RevokeAuthorization

func (h *AuthorizationHandler) RevokeAuthorization(c *gin.Context)

RevokeAuthorization revokes a user's consent for one application (POST /account/authorizations/:uuid/revoke).

func (*AuthorizationHandler) ShowAuthorizePage

func (h *AuthorizationHandler) ShowAuthorizePage(c *gin.Context)

ShowAuthorizePage renders the OAuth consent page (GET /oauth/authorize). Requires the user to be logged in (enforced by RequireAuth middleware).

type ClientHandler

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

func (*ClientHandler) ApproveClient added in v0.17.0

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

ApproveClient sets a pending client's status to active.

func (*ClientHandler) CreateClient

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

CreateClient handles the creation of a new OAuth client

func (*ClientHandler) DeleteClient

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

DeleteClient handles deleting an OAuth client

func (*ClientHandler) InjectPendingCount added in v0.17.0

func (h *ClientHandler) InjectPendingCount() gin.HandlerFunc

InjectPendingCount is a middleware that queries the pending client count for admin users and stores it in the gin context so buildNavbarProps can show the badge on every page. Non-admin users are skipped to avoid unnecessary queries.

func (*ClientHandler) ListClientAuthorizations

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

ListClientAuthorizations shows all users who have granted access to this client (admin overview).

func (*ClientHandler) RegenerateSecret

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

RegenerateSecret handles POST /admin/clients/:id/regenerate-secret to regenerate the client secret

func (*ClientHandler) RejectClient added in v0.17.0

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

RejectClient sets a pending client's status to inactive.

func (*ClientHandler) RevokeAllTokens

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

RevokeAllTokens revokes all active tokens for a client (admin danger zone action).

func (*ClientHandler) ShowClientsPage

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

ShowClientsPage displays the list of all OAuth clients

func (*ClientHandler) ShowCreateClientPage

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

ShowCreateClientPage displays the form to create a new client

func (*ClientHandler) ShowEditClientPage

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

ShowEditClientPage displays the form to edit an existing client

func (*ClientHandler) UpdateClient

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

UpdateClient handles updating an existing OAuth client

func (*ClientHandler) ViewClient

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

ViewClient displays detailed information about a client

type DashboardHandler added in v0.24.0

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

DashboardHandler serves the admin dashboard page.

func NewDashboardHandler added in v0.24.0

func NewDashboardHandler(ds *services.DashboardService) *DashboardHandler

NewDashboardHandler creates a new DashboardHandler.

func (*DashboardHandler) ShowDashboard added in v0.24.0

func (h *DashboardHandler) ShowDashboard(c *gin.Context)

ShowDashboard renders the admin dashboard with system metrics and recent activity.

type DeviceHandler

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

func (*DeviceHandler) DeviceCodeRequest

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

DeviceCodeRequest godoc

@Summary		Request device code
@Description	Request a device code for OAuth 2.0 device authorization flow (RFC 8628). This endpoint is called by CLI applications to initiate the device flow.
@Tags			OAuth
@Accept			json
@Accept			x-www-form-urlencoded
@Produce		json
@Param			client_id	formData	string																																true	"OAuth client ID"
@Param			scope		formData	string																																false	"Requested scopes (space-separated, default: 'email profile')"
@Success		200			{object}	object{device_code=string,user_code=string,verification_uri=string,verification_uri_complete=string,expires_in=int,interval=int}	"Device code generated successfully"
@Failure		400			{object}	object{error=string,error_description=string}																						"Invalid request (invalid_client)"
@Failure		429			{object}	object{error=string,error_description=string}																						"Rate limit exceeded"
@Failure		500			{object}	object{error=string,error_description=string}																						"Internal server error"
@Router			/oauth/device/code [post]

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 DocsHandler added in v0.16.0

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

DocsHandler serves static documentation pages rendered from embedded Markdown, with per-locale content served from language subfolders. Sidebar entries and language-switcher options are precomputed at boot so each request only passes pointers to immutable slices into the template.

func NewDocsHandler added in v0.16.0

func NewDocsHandler(templatesFS fs.FS, secureCookies bool) *DocsHandler

NewDocsHandler reads and pre-parses all Markdown documentation files, for every supported locale, at startup. Missing translations transparently fall back to the default locale so new languages can be added incrementally.

The handler accepts any fs.FS; production wires the embed.FS from main, while tests can supply an fstest.MapFS to assert locale-parity invariants without reading from disk. secureCookies should be true when the server is reachable over HTTPS (matches middleware.SessionOptions' isProduction convention).

func (*DocsHandler) ShowDocsEntry added in v0.28.0

func (h *DocsHandler) ShowDocsEntry(c *gin.Context)

ShowDocsEntry handles GET /docs/:lang where the path parameter may be either a locale code (e.g. /docs/zh-TW → first page of zh-TW) or a legacy slug from the pre-i18n URL scheme (/docs/getting-started → same slug under the detected locale). Unknown values redirect back to /docs.

func (*DocsHandler) ShowDocsIndex added in v0.16.0

func (h *DocsHandler) ShowDocsIndex(c *gin.Context)

ShowDocsIndex handles GET /docs. It detects the user's preferred locale and redirects to the canonical /docs/<locale>/<first-slug> URL so every rendered page has the locale explicitly in its path.

func (*DocsHandler) ShowDocsPage added in v0.16.0

func (h *DocsHandler) ShowDocsPage(c *gin.Context)

ShowDocsPage handles GET /docs/:lang/:slug — the canonical URL. It validates both path parameters, renders the page, and persists the locale to a cookie so future bare-URL visits (/docs or /docs/<slug>) default to the same choice.

type JSONWebKey added in v0.22.0

type JSONWebKey struct {
	Kty string `json:"kty"`           // Key type: "RSA" or "EC"
	Use string `json:"use"`           // Key use: "sig"
	Kid string `json:"kid,omitempty"` // Key ID
	Alg string `json:"alg"`           // Algorithm: "RS256" or "ES256"
	N   string `json:"n,omitempty"`   // RSA modulus (base64url)
	E   string `json:"e,omitempty"`   // RSA exponent (base64url)
	Crv string `json:"crv,omitempty"` // EC curve: "P-256"
	X   string `json:"x,omitempty"`   // EC x coordinate (base64url)
	Y   string `json:"y,omitempty"`   // EC y coordinate (base64url)
}

JSONWebKey represents a single key in a JWKS response (RFC 7517).

type JWKSHandler added in v0.22.0

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

JWKSHandler serves the JWKS endpoint.

func NewJWKSHandler added in v0.22.0

func NewJWKSHandler(algorithm, kid string, publicKey any) *JWKSHandler

NewJWKSHandler builds a JWKSHandler from the token provider's public key. For HS256 (no public key), the keys array is empty.

func (*JWKSHandler) JWKS added in v0.22.0

func (h *JWKSHandler) JWKS(c *gin.Context)

JWKS godoc

@Summary		JSON Web Key Set
@Description	Returns the public keys used to verify JWT signatures (RFC 7517)
@Tags			OIDC
@Produce		json
@Success		200	{object}	JWKSResponse	"JWKS document"
@Router			/.well-known/jwks.json [get]

func (*JWKSHandler) Keys added in v0.22.0

func (h *JWKSHandler) Keys() []JSONWebKey

Keys returns a copy of the JSON Web Keys in the JWKS response.

type JWKSResponse added in v0.22.0

type JWKSResponse struct {
	Keys []JSONWebKey `json:"keys"`
}

JWKSResponse is the top-level JWKS document (RFC 7517 §5).

type Locale added in v0.28.0

type Locale string

Locale identifies a supported documentation language.

const (
	LocaleEN   Locale = "en"
	LocaleZHTW Locale = "zh-TW"

	// DocsDefaultLocale is the fallback when no user preference is detectable.
	DocsDefaultLocale = LocaleEN
)

type OAuthHandler

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

OAuthHandler handles OAuth authentication

func NewOAuthHandler

func NewOAuthHandler(
	providers map[string]*auth.OAuthProvider,
	userService *services.UserService,
	httpClient *http.Client,
	cfg *config.Config,
	m core.Recorder,
) *OAuthHandler

NewOAuthHandler creates a new OAuth handler

func (*OAuthHandler) LoginWithProvider

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

LoginWithProvider redirects user to OAuth provider

func (*OAuthHandler) OAuthCallback

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

OAuthCallback handles OAuth provider callback

type OIDCHandler added in v0.11.0

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

OIDCHandler handles OIDC Discovery and UserInfo endpoints.

func NewOIDCHandler added in v0.11.0

func NewOIDCHandler(
	ts *services.TokenService,
	us *services.UserService,
	cfg *config.Config,
	jwksAvailable bool,
	idTokenSupported bool,
) *OIDCHandler

NewOIDCHandler creates a new OIDCHandler.

func (*OIDCHandler) Discovery added in v0.11.0

func (h *OIDCHandler) Discovery(c *gin.Context)

Discovery godoc

@Summary		OIDC Discovery
@Description	OpenID Connect Provider Metadata (RFC 8414 / OIDC Discovery 1.0)
@Tags			OIDC
@Produce		json
@Success		200	{object}	discoveryMetadata	"Provider metadata"
@Router			/.well-known/openid-configuration [get]

func (*OIDCHandler) UserInfo added in v0.11.0

func (h *OIDCHandler) UserInfo(c *gin.Context)

UserInfo godoc

@Summary		UserInfo Endpoint
@Description	Returns claims about the authenticated end-user (OIDC Core 1.0 §5.3). Supports both GET and POST.
@Tags			OIDC
@Produce		json
@Security		BearerAuth
@Param			Authorization	header		string											true	"Bearer token"
@Success		200				{object}	object											"User claims (sub, name, email, etc.)"
@Failure		401				{object}	object{error=string,error_description=string}	"Invalid or missing Bearer token"
@Router			/oauth/userinfo [get]
@Router			/oauth/userinfo [post]

type RegistrationHandler added in v0.20.0

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

RegistrationHandler handles Dynamic Client Registration (RFC 7591).

func NewRegistrationHandler added in v0.20.0

func NewRegistrationHandler(
	cs *services.ClientService,
	auditSvc core.AuditLogger,
	cfg *config.Config,
) *RegistrationHandler

NewRegistrationHandler creates a new RegistrationHandler.

func (*RegistrationHandler) Register added in v0.20.0

func (h *RegistrationHandler) Register(c *gin.Context)

Register godoc

@Summary		Register a new OAuth client (RFC 7591)
@Description	Dynamically register a new OAuth 2.0 client. Must be enabled via ENABLE_DYNAMIC_CLIENT_REGISTRATION=true. Registered clients start in "pending" status and require admin approval before use.
@Tags			OAuth
@Accept			json
@Produce		json
@Param			request	body		clientRegistrationRequest															true	"Client registration request"
@Success		201		{object}	object{client_id=string,client_secret=string,client_name=string,redirect_uris=[]string,grant_types=[]string,token_endpoint_auth_method=string,scope=string,client_id_issued_at=int,client_secret_expires_at=int}	"Client registered successfully"
@Failure		400		{object}	object{error=string,error_description=string}											"Invalid client metadata"
@Failure		401		{object}	object{error=string,error_description=string}											"Invalid or missing initial access token"
@Failure		403		{object}	object{error=string,error_description=string}											"Dynamic registration is disabled"
@Failure		429		{object}	object{error=string,error_description=string}											"Rate limit exceeded"
@Failure		500		{object}	object{error=string,error_description=string}											"Internal server error"
@Router			/oauth/register [post]

type SessionHandler

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

func NewSessionHandler

func NewSessionHandler(ts *services.TokenService) *SessionHandler

func (*SessionHandler) DisableSession

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

DisableSession temporarily disables a specific session by token ID

func (*SessionHandler) EnableSession

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

EnableSession re-enables a previously disabled session by token ID

func (*SessionHandler) ListSessions

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

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

func (*SessionHandler) RevokeAllSessions

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

RevokeAllSessions revokes all sessions for the current user

func (*SessionHandler) RevokeSession

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

RevokeSession revokes a specific session by token ID

type TokenAdminHandler added in v0.24.0

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

func NewTokenAdminHandler added in v0.24.0

func NewTokenAdminHandler(ts *services.TokenService) *TokenAdminHandler

func (*TokenAdminHandler) DisableToken added in v0.24.0

func (h *TokenAdminHandler) DisableToken(c *gin.Context)

func (*TokenAdminHandler) EnableToken added in v0.24.0

func (h *TokenAdminHandler) EnableToken(c *gin.Context)

func (*TokenAdminHandler) RevokeToken added in v0.24.0

func (h *TokenAdminHandler) RevokeToken(c *gin.Context)

func (*TokenAdminHandler) ShowTokensPage added in v0.24.0

func (h *TokenAdminHandler) ShowTokensPage(c *gin.Context)

type TokenHandler

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

func (*TokenHandler) Introspect added in v0.20.0

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

Introspect godoc

@Summary		Introspect token (RFC 7662)
@Description	Determine the active state and metadata of an OAuth 2.0 token. Requires client authentication via HTTP Basic Auth or form-body client credentials.
@Tags			OAuth
@Accept			x-www-form-urlencoded
@Produce		json
@Param			token			formData	string																																		true	"The token to introspect"
@Param			token_type_hint	formData	string																																		false	"Hint about the type of token: 'access_token' or 'refresh_token'"
@Param			client_id		formData	string																																		false	"Client ID (alternative to HTTP Basic Auth)"
@Param			client_secret	formData	string																																		false	"Client secret (alternative to HTTP Basic Auth)"
@Success		200				{object}	object{active=bool,scope=string,client_id=string,username=string,token_type=string,exp=int,iat=int,sub=string,iss=string,jti=string}	"Token introspection response"
@Failure		401				{object}	object{error=string,error_description=string}																							"Client authentication failed"
@Router			/oauth/introspect [post]

func (*TokenHandler) Revoke

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

Revoke godoc

@Summary		Revoke token
@Description	Revoke an access token or refresh token (RFC 7009). Returns 200 for both successful revocation and invalid tokens to prevent token scanning attacks.
@Tags			OAuth
@Accept			json
@Accept			x-www-form-urlencoded
@Produce		json
@Param			token			formData	string											true	"Token to revoke (access token or refresh token)"
@Param			token_type_hint	formData	string											false	"Token type hint: 'access_token' or 'refresh_token'"
@Success		200				{string}	string											"Token revoked successfully (or invalid token)"
@Failure		400				{object}	object{error=string,error_description=string}	"Invalid request (token parameter missing)"
@Router			/oauth/revoke [post]

func (*TokenHandler) Token

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

Token godoc

@Summary		Request access token
@Description	Exchange device code or refresh token for access token (RFC 8628 and RFC 6749)
@Tags			OAuth
@Accept			json
@Accept			x-www-form-urlencoded
@Produce		json
@Param			grant_type		formData	string																							true	"Grant type: 'urn:ietf:params:oauth:grant-type:device_code' or 'refresh_token'"
@Param			device_code		formData	string																							false	"Device code (required when grant_type=device_code)"
@Param			client_id		formData	string																							true	"OAuth client ID"
@Param			refresh_token	formData	string																							false	"Refresh token (required when grant_type=refresh_token)"
@Success		200				{object}	object{access_token=string,refresh_token=string,token_type=string,expires_in=int,scope=string}	"Access token issued successfully"
@Failure		400				{object}	object{error=string,error_description=string}													"Invalid request (unsupported_grant_type, invalid_request, authorization_pending, slow_down, expired_token, access_denied, invalid_grant)"
@Failure		429				{object}	object{error=string,error_description=string}													"Rate limit exceeded"
@Failure		500				{object}	object{error=string,error_description=string}													"Internal server error"
@Router			/oauth/token [post]

func (*TokenHandler) TokenInfo

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

TokenInfo godoc

@Summary		Validate access token
@Description	Verify JWT token validity and retrieve token information (RFC 7662 style introspection)
@Tags			OAuth
@Accept			json
@Produce		json
@Security		BearerAuth
@Param			Authorization	header		string																				true	"Bearer token (format: 'Bearer <token>')"
@Success		200				{object}	object{active=bool,user_id=string,client_id=string,scope=string,exp=int,iss=string}	"Token is valid"
@Failure		401				{object}	object{error=string,error_description=string}										"Token is invalid or expired (missing_token, invalid_token)"
@Router			/oauth/tokeninfo [get]

type UserAdminHandler added in v0.24.0

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

UserAdminHandler handles admin user management routes.

func NewUserAdminHandler added in v0.24.0

NewUserAdminHandler creates a new UserAdminHandler.

func (*UserAdminHandler) CreateUser added in v0.26.0

func (h *UserAdminHandler) CreateUser(c *gin.Context)

CreateUser handles the user creation form submission.

func (*UserAdminHandler) DeleteUser added in v0.24.0

func (h *UserAdminHandler) DeleteUser(c *gin.Context)

DeleteUser handles user deletion.

func (*UserAdminHandler) DeleteUserConnection added in v0.26.0

func (h *UserAdminHandler) DeleteUserConnection(c *gin.Context)

DeleteUserConnection handles unlinking an OAuth connection.

func (*UserAdminHandler) DisableUser added in v0.26.0

func (h *UserAdminHandler) DisableUser(c *gin.Context)

DisableUser handles disabling a user account.

func (*UserAdminHandler) EnableUser added in v0.26.0

func (h *UserAdminHandler) EnableUser(c *gin.Context)

EnableUser handles enabling a user account.

func (*UserAdminHandler) ResetPassword added in v0.24.0

func (h *UserAdminHandler) ResetPassword(c *gin.Context)

ResetPassword generates a new random password and displays it once.

func (*UserAdminHandler) RevokeUserAuthorization added in v0.26.0

func (h *UserAdminHandler) RevokeUserAuthorization(c *gin.Context)

RevokeUserAuthorization handles revoking a user's app authorization.

func (*UserAdminHandler) ShowCreateUserPage added in v0.26.0

func (h *UserAdminHandler) ShowCreateUserPage(c *gin.Context)

ShowCreateUserPage renders the user creation form.

func (*UserAdminHandler) ShowEditUserPage added in v0.24.0

func (h *UserAdminHandler) ShowEditUserPage(c *gin.Context)

ShowEditUserPage renders the user edit form.

func (*UserAdminHandler) ShowUserAuthorizations added in v0.26.0

func (h *UserAdminHandler) ShowUserAuthorizations(c *gin.Context)

ShowUserAuthorizations renders the user's authorized apps page.

func (*UserAdminHandler) ShowUserConnections added in v0.26.0

func (h *UserAdminHandler) ShowUserConnections(c *gin.Context)

ShowUserConnections renders the user's OAuth connections page.

func (*UserAdminHandler) ShowUsersPage added in v0.24.0

func (h *UserAdminHandler) ShowUsersPage(c *gin.Context)

ShowUsersPage renders the paginated user list.

func (*UserAdminHandler) UpdateUser added in v0.24.0

func (h *UserAdminHandler) UpdateUser(c *gin.Context)

UpdateUser handles the user update form submission.

func (*UserAdminHandler) ViewUser added in v0.24.0

func (h *UserAdminHandler) ViewUser(c *gin.Context)

ViewUser renders the user detail page.

type UserClientHandler added in v0.17.0

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

UserClientHandler handles the /apps area for authenticated (non-admin) users to register and manage their own OAuth applications.

func NewUserClientHandler added in v0.17.0

func NewUserClientHandler(cs *services.ClientService) *UserClientHandler

func (*UserClientHandler) CreateApp added in v0.17.0

func (h *UserClientHandler) CreateApp(c *gin.Context)

CreateApp handles POST /apps to register a new OAuth client.

func (*UserClientHandler) DeleteApp added in v0.17.0

func (h *UserClientHandler) DeleteApp(c *gin.Context)

DeleteApp handles POST /apps/:id/delete to remove a pending or inactive user-owned app.

func (*UserClientHandler) RegenerateAppSecret added in v0.17.0

func (h *UserClientHandler) RegenerateAppSecret(c *gin.Context)

RegenerateAppSecret handles POST /apps/:id/regenerate-secret.

func (*UserClientHandler) ShowAppPage added in v0.17.0

func (h *UserClientHandler) ShowAppPage(c *gin.Context)

ShowAppPage displays details for a user-owned app.

func (*UserClientHandler) ShowCreateAppPage added in v0.17.0

func (h *UserClientHandler) ShowCreateAppPage(c *gin.Context)

ShowCreateAppPage displays the form to register a new application.

func (*UserClientHandler) ShowEditAppPage added in v0.17.0

func (h *UserClientHandler) ShowEditAppPage(c *gin.Context)

ShowEditAppPage displays the edit form for a user-owned app.

func (*UserClientHandler) ShowMyAppsPage added in v0.17.0

func (h *UserClientHandler) ShowMyAppsPage(c *gin.Context)

ShowMyAppsPage lists all OAuth applications owned by the logged-in user.

func (*UserClientHandler) UpdateApp added in v0.17.0

func (h *UserClientHandler) UpdateApp(c *gin.Context)

UpdateApp handles POST /apps/:id to update a user-owned app.

Jump to

Keyboard shortcuts

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