Documentation
¶
Overview ¶
Package pluginsv1 implements the Kleff plugin gRPC contract.
Wire format: The codec registered here overrides gRPC's default protobuf codec with a JSON codec. This lets the package ship without a protoc build step while still speaking standard gRPC framing. Both the platform (client) and all Go plugins (server) import this package and therefore share the same codec automatically via init().
To switch to protobuf wire format: generate pb.go files from the .proto files in plugin-sdk/v1/proto/ using protoc, then delete this file and replace types.go / *.go stubs with the generated output.
Index ¶
- Constants
- Variables
- func RegisterIdentityPluginServer(s grpc.ServiceRegistrar, srv IdentityPluginServer)
- func RegisterPluginHTTPServer(s grpc.ServiceRegistrar, srv PluginHTTPServer)
- func RegisterPluginHealthServer(s grpc.ServiceRegistrar, srv PluginHealthServer)
- func RegisterPluginMiddlewareServer(s grpc.ServiceRegistrar, srv PluginMiddlewareServer)
- func RegisterPluginUIServer(s grpc.ServiceRegistrar, srv PluginUIServer)
- type ChangePasswordRequest
- type ChangePasswordResponse
- type EnsureAdminRequest
- type EnsureAdminResponse
- type ErrorCode
- type GetCapabilitiesRequest
- type GetCapabilitiesResponse
- type GetOIDCConfigRequest
- type GetOIDCConfigResponse
- type GetRoutesRequest
- type GetRoutesResponse
- type GetUIManifestRequest
- type GetUIManifestResponse
- type GetUserRequest
- type GetUserResponse
- type HTTPRequest
- type HTTPResponse
- type HandleHTTPRequest
- type HandleHTTPResponse
- type HealthRequest
- type HealthResponse
- type HealthStatus
- type IdentityPluginClient
- type IdentityPluginServer
- type JWTClaims
- type JWTValidator
- type ListSessionsRequest
- type ListSessionsResponse
- type LoginConfig
- type LoginRequest
- type LoginResponse
- type MiddlewareRequest
- type MiddlewareResponse
- type NavItem
- type OIDCConfig
- type PluginError
- type PluginHTTPClient
- type PluginHTTPServer
- type PluginHealthClient
- type PluginHealthServer
- type PluginMiddlewareClient
- type PluginMiddlewareServer
- type PluginUIClient
- type PluginUIServer
- type ProfileSection
- type RefreshTokenRequest
- type RefreshTokenResponse
- type RegisterRequest
- type RegisterResponse
- type RevokeSessionRequest
- type RevokeSessionResponse
- type Route
- type Session
- type SettingsPage
- type SignupConfig
- type TokenClaims
- type TokenSet
- type UIManifest
- type UnimplementedIdentityPluginServer
- func (UnimplementedIdentityPluginServer) ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error)
- func (UnimplementedIdentityPluginServer) EnsureAdmin(context.Context, *EnsureAdminRequest) (*EnsureAdminResponse, error)
- func (UnimplementedIdentityPluginServer) GetOIDCConfig(context.Context, *GetOIDCConfigRequest) (*GetOIDCConfigResponse, error)
- func (UnimplementedIdentityPluginServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error)
- func (UnimplementedIdentityPluginServer) Health(context.Context, *HealthRequest) (*HealthResponse, error)
- func (UnimplementedIdentityPluginServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
- func (UnimplementedIdentityPluginServer) Login(context.Context, *LoginRequest) (*LoginResponse, error)
- func (UnimplementedIdentityPluginServer) RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
- func (UnimplementedIdentityPluginServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
- func (UnimplementedIdentityPluginServer) RevokeSession(context.Context, *RevokeSessionRequest) (*RevokeSessionResponse, error)
- func (UnimplementedIdentityPluginServer) ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
- type UnimplementedPluginHTTPServer
- type UnimplementedPluginHealthServer
- type UnimplementedPluginMiddlewareServer
- type UnimplementedPluginUIServer
- type UserInfo
- type ValidateTokenRequest
- type ValidateTokenResponse
Constants ¶
const ( // TagFrontend allows ui.manifest. Use for plugins that only contribute UI. TagFrontend = "frontend" // TagBackend allows api.middleware and api.routes. Use for plugins that // intercept or own HTTP routes on the platform API. TagBackend = "backend" // TagIdentity allows identity.provider. Use for authentication/IDP plugins. TagIdentity = "identity" // TagDevOps is reserved for future daemon and Kubernetes capabilities. TagDevOps = "devops" )
Layer tags declare which part of the stack a plugin touches. The platform uses these to enforce capability permissions — a plugin may only exercise capabilities that its declared layer tags permit.
const ( // CapabilityAPIMiddleware: plugin implements PluginMiddleware.OnRequest. // The platform calls it before every authenticated handler. CapabilityAPIMiddleware = "api.middleware" // CapabilityUIManifest: plugin implements PluginUI.GetUIManifest. // The panel fetches aggregated manifests to render plugin-contributed UI. CapabilityUIManifest = "ui.manifest" // CapabilityAPIRoutes: plugin implements PluginHTTP.GetRoutes + Handle. // The platform intercepts declared routes and forwards them to the plugin // as raw HTTP requests. The plugin owns 100% of the response. CapabilityAPIRoutes = "api.routes" // CapabilityIdentityProvider: plugin is an authentication/identity provider. // The platform uses this to determine whether auth is available, exposing // GET /api/v1/auth/config with enabled:false when no such plugin is active. CapabilityIdentityProvider = "identity.provider" )
Standard capability keys a plugin can declare via GetCapabilities.
Variables ¶
var IdentityPlugin_ServiceDesc = grpc.ServiceDesc{ ServiceName: "kleff.plugins.v1.IdentityPlugin", HandlerType: (*IdentityPluginServer)(nil), Methods: []grpc.MethodDesc{ {MethodName: "Login", Handler: _IdentityPlugin_Login_Handler}, {MethodName: "Register", Handler: _IdentityPlugin_Register_Handler}, {MethodName: "GetUser", Handler: _IdentityPlugin_GetUser_Handler}, {MethodName: "Health", Handler: _IdentityPlugin_Health_Handler}, {MethodName: "ValidateToken", Handler: _IdentityPlugin_ValidateToken_Handler}, {MethodName: "GetOIDCConfig", Handler: _IdentityPlugin_GetOIDCConfig_Handler}, {MethodName: "RefreshToken", Handler: _IdentityPlugin_RefreshToken_Handler}, {MethodName: "EnsureAdmin", Handler: _IdentityPlugin_EnsureAdmin_Handler}, {MethodName: "ChangePassword", Handler: _IdentityPlugin_ChangePassword_Handler}, {MethodName: "ListSessions", Handler: _IdentityPlugin_ListSessions_Handler}, {MethodName: "RevokeSession", Handler: _IdentityPlugin_RevokeSession_Handler}, }, Streams: []grpc.StreamDesc{}, Metadata: "idp.proto", }
var PluginHTTP_ServiceDesc = grpc.ServiceDesc{ ServiceName: "kleff.plugins.v1.PluginHTTP", HandlerType: (*PluginHTTPServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetRoutes", Handler: _PluginHTTP_GetRoutes_Handler, }, { MethodName: "Handle", Handler: _PluginHTTP_Handle_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "pluginhttp.proto", }
var PluginHealth_ServiceDesc = grpc.ServiceDesc{ ServiceName: "kleff.plugins.v1.PluginHealth", HandlerType: (*PluginHealthServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Health", Handler: _PluginHealth_Health_Handler, }, { MethodName: "GetCapabilities", Handler: _PluginHealth_GetCapabilities_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "common.proto", }
var PluginMiddleware_ServiceDesc = grpc.ServiceDesc{ ServiceName: "kleff.plugins.v1.PluginMiddleware", HandlerType: (*PluginMiddlewareServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "OnRequest", Handler: _PluginMiddleware_OnRequest_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "middleware.proto", }
var PluginUI_ServiceDesc = grpc.ServiceDesc{ ServiceName: "kleff.plugins.v1.PluginUI", HandlerType: (*PluginUIServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetUIManifest", Handler: _PluginUI_GetUIManifest_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "ui.proto", }
Functions ¶
func RegisterIdentityPluginServer ¶
func RegisterIdentityPluginServer(s grpc.ServiceRegistrar, srv IdentityPluginServer)
func RegisterPluginHTTPServer ¶
func RegisterPluginHTTPServer(s grpc.ServiceRegistrar, srv PluginHTTPServer)
func RegisterPluginHealthServer ¶
func RegisterPluginHealthServer(s grpc.ServiceRegistrar, srv PluginHealthServer)
func RegisterPluginMiddlewareServer ¶
func RegisterPluginMiddlewareServer(s grpc.ServiceRegistrar, srv PluginMiddlewareServer)
func RegisterPluginUIServer ¶
func RegisterPluginUIServer(s grpc.ServiceRegistrar, srv PluginUIServer)
Types ¶
type ChangePasswordRequest ¶
type ChangePasswordRequest struct {
UserID string `json:"user_id"`
CurrentPassword string `json:"current_password"`
NewPassword string `json:"new_password"`
}
ChangePasswordRequest is sent by the platform to change a user's password. UserID is the IDP subject claim. CurrentPassword is verified by the plugin before the new password is applied.
type ChangePasswordResponse ¶
type ChangePasswordResponse struct {
Error *PluginError `json:"error,omitempty"`
}
type EnsureAdminRequest ¶
type EnsureAdminRequest struct{}
EnsureAdminRequest is sent by the platform after installing an IDP plugin to trigger admin-user seeding. Each IDP plugin implements this according to its own system (Keycloak realm roles, Authentik groups, etc.).
type EnsureAdminResponse ¶
type EnsureAdminResponse struct {
Error *PluginError `json:"error,omitempty"`
}
type GetCapabilitiesRequest ¶
type GetCapabilitiesRequest struct{}
type GetCapabilitiesResponse ¶
type GetCapabilitiesResponse struct {
Capabilities []string `json:"capabilities"`
}
type GetOIDCConfigRequest ¶
type GetOIDCConfigRequest struct{}
type GetOIDCConfigResponse ¶
type GetOIDCConfigResponse struct {
Config *OIDCConfig `json:"config,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type GetRoutesRequest ¶
type GetRoutesRequest struct{}
type GetRoutesResponse ¶
type GetRoutesResponse struct {
Routes []*Route `json:"routes"`
Error *PluginError `json:"error,omitempty"`
}
type GetUIManifestRequest ¶
type GetUIManifestRequest struct{}
type GetUIManifestResponse ¶
type GetUIManifestResponse struct {
Manifest *UIManifest `json:"manifest,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type GetUserRequest ¶
type GetUserRequest struct {
UserID string `json:"user_id"`
}
type GetUserResponse ¶
type GetUserResponse struct {
User *UserInfo `json:"user,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type HTTPRequest ¶
type HTTPRequest struct {
Method string `json:"method"`
Path string `json:"path"`
RawQuery string `json:"raw_query,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Body []byte `json:"body,omitempty"`
UserID string `json:"user_id,omitempty"`
Roles []string `json:"roles,omitempty"`
}
HTTPRequest is the forwarded HTTP request the plugin receives via Handle. UserID and Roles are injected by the platform after token validation for non-public routes.
type HTTPResponse ¶
type HTTPResponse struct {
StatusCode int `json:"status_code"`
Headers map[string]string `json:"headers,omitempty"`
Body []byte `json:"body"`
}
HTTPResponse is what the plugin returns; the platform writes it verbatim.
type HandleHTTPRequest ¶
type HandleHTTPRequest struct {
Request *HTTPRequest `json:"request"`
}
type HandleHTTPResponse ¶
type HandleHTTPResponse struct {
Response *HTTPResponse `json:"response,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type HealthRequest ¶
type HealthRequest struct{}
type HealthResponse ¶
type HealthResponse struct {
Status HealthStatus `json:"status"`
Message string `json:"message,omitempty"`
}
type HealthStatus ¶
type HealthStatus int32
const ( HealthStatusUnknown HealthStatus = 0 HealthStatusHealthy HealthStatus = 1 HealthStatusDegraded HealthStatus = 2 HealthStatusUnhealthy HealthStatus = 3 )
type IdentityPluginClient ¶
type IdentityPluginClient interface {
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error)
Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
// ValidateToken verifies a bearer token and returns its claims.
// The platform calls this on every authenticated request.
ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error)
// GetOIDCConfig returns the OIDC configuration for the frontend.
GetOIDCConfig(ctx context.Context, in *GetOIDCConfigRequest, opts ...grpc.CallOption) (*GetOIDCConfigResponse, error)
// RefreshToken exchanges a refresh token for a new token set.
RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error)
// EnsureAdmin seeds the IDP's admin user and assigns the platform "admin"
// role. The platform calls this once after installing an IDP plugin.
EnsureAdmin(ctx context.Context, in *EnsureAdminRequest, opts ...grpc.CallOption) (*EnsureAdminResponse, error)
// ChangePassword verifies the current password and sets a new one.
// The plugin is responsible for verifying CurrentPassword before applying NewPassword.
ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error)
// ListSessions returns all active sessions for a user.
ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error)
// RevokeSession terminates a specific session by ID.
RevokeSession(ctx context.Context, in *RevokeSessionRequest, opts ...grpc.CallOption) (*RevokeSessionResponse, error)
}
func NewIdentityPluginClient ¶
func NewIdentityPluginClient(cc grpc.ClientConnInterface) IdentityPluginClient
type IdentityPluginServer ¶
type IdentityPluginServer interface {
Login(context.Context, *LoginRequest) (*LoginResponse, error)
Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error)
Health(context.Context, *HealthRequest) (*HealthResponse, error)
ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
GetOIDCConfig(context.Context, *GetOIDCConfigRequest) (*GetOIDCConfigResponse, error)
RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
EnsureAdmin(context.Context, *EnsureAdminRequest) (*EnsureAdminResponse, error)
ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error)
ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
RevokeSession(context.Context, *RevokeSessionRequest) (*RevokeSessionResponse, error)
}
type JWTClaims ¶
type JWTClaims struct {
Subject string
Username string
Email string
Roles []string
// SessionID is the value of the "sid" claim, if present.
// Used for session revocation: after RevokeSession is called with this ID,
// ValidateToken will return an error for any token carrying the same sid.
SessionID string
// ExpiresAt is the token expiry (unix seconds), used to auto-evict
// the revocation entry once the token can no longer be used anyway.
ExpiresAt int64
}
JWTClaims holds the verified identity extracted from a validated JWT.
type JWTValidator ¶
type JWTValidator struct {
// contains filtered or unexported fields
}
JWTValidator verifies RS256 JWTs against a JWKS endpoint and enforces session revocation in-process. Safe for concurrent use.
Per-instance state (keys cache, revocation set) avoids the package-level global bug that arises when a single package hosts multiple validator instances.
func NewJWTValidator ¶
func NewJWTValidator(jwksURL string) *JWTValidator
NewJWTValidator creates a validator that fetches JWKS from jwksURL. The JWKS response is cached for 5 minutes; a cache miss triggers one re-fetch.
func (*JWTValidator) RevokeSession ¶
func (v *JWTValidator) RevokeSession(sessionID string, ttl time.Duration)
RevokeSession marks sessionID as revoked until ttl elapses. Any subsequent ValidateToken call for a token carrying this session ID will return an error, regardless of the token's cryptographic validity.
Set ttl to at least the maximum access-token lifetime for your IDP so that the revocation outlives any tokens that were issued for this session.
func (*JWTValidator) ValidateToken ¶
ValidateToken verifies an RS256 JWT and returns its claims. Returns an error if the signature is invalid, the token is expired, or the session has been explicitly revoked via RevokeSession.
type ListSessionsRequest ¶
type ListSessionsResponse ¶
type ListSessionsResponse struct {
Sessions []*Session `json:"sessions,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type LoginConfig ¶
type LoginConfig struct {
// DisableSignupLink hides the "Create account" link on the login page.
DisableSignupLink bool `json:"disable_signup_link,omitempty"`
}
LoginConfig lets an IDP plugin customise the panel's headless login form.
type LoginRequest ¶
type LoginResponse ¶
type LoginResponse struct {
Token *TokenSet `json:"token,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type MiddlewareRequest ¶
type MiddlewareRequest struct {
UserID string `json:"user_id"`
Roles []string `json:"roles,omitempty"`
Method string `json:"method"`
Path string `json:"path"`
Headers map[string]string `json:"headers,omitempty"`
}
MiddlewareRequest is sent to PluginMiddleware.OnRequest for every authenticated HTTP request. The platform has already validated the token; UserID and Roles are the verified identity. The plugin may allow or deny the request.
type MiddlewareResponse ¶
type MiddlewareResponse struct {
Allow bool `json:"allow"`
Error *PluginError `json:"error,omitempty"`
}
MiddlewareResponse is returned by PluginMiddleware.OnRequest. If Allow is false, the platform rejects the request with the Error message.
type NavItem ¶
type NavItem struct {
}
NavItem represents a navigation item contributed by a plugin.
type OIDCConfig ¶
type OIDCConfig struct {
Authority string `json:"authority"`
ClientID string `json:"client_id"`
JwksURI string `json:"jwks_uri"`
Scopes []string `json:"scopes,omitempty"`
// AuthMode controls whether the panel uses a headless login form or an
// OIDC Authorization Code redirect to the IDP. Valid values: "headless"
// (default) or "redirect".
AuthMode string `json:"auth_mode,omitempty"`
// Pre-fetched OIDC endpoint URLs. When set, the frontend passes them as
// metadata to oidc-client-ts so it skips the cross-origin discovery fetch.
TokenEndpoint string `json:"token_endpoint,omitempty"`
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`
UserinfoEndpoint string `json:"userinfo_endpoint,omitempty"`
EndSessionEndpoint string `json:"end_session_endpoint,omitempty"`
// InternalTokenEndpoint is the Docker-internal token endpoint URL.
// The platform uses it to proxy PKCE token exchanges server-side so the
// browser never has to POST cross-origin to the IDP.
InternalTokenEndpoint string `json:"internal_token_endpoint,omitempty"`
}
OIDCConfig carries the OIDC parameters the frontend needs to initialise its OIDC client library.
type PluginError ¶
func (*PluginError) Error ¶
func (e *PluginError) Error() string
type PluginHTTPClient ¶
type PluginHTTPClient interface {
GetRoutes(ctx context.Context, in *GetRoutesRequest, opts ...grpc.CallOption) (*GetRoutesResponse, error)
Handle(ctx context.Context, in *HandleHTTPRequest, opts ...grpc.CallOption) (*HandleHTTPResponse, error)
}
PluginHTTPClient is implemented by plugins that declare CapabilityAPIRoutes. The platform calls GetRoutes once on connect, then Handle for every matched request.
func NewPluginHTTPClient ¶
func NewPluginHTTPClient(cc grpc.ClientConnInterface) PluginHTTPClient
type PluginHTTPServer ¶
type PluginHTTPServer interface {
GetRoutes(context.Context, *GetRoutesRequest) (*GetRoutesResponse, error)
Handle(context.Context, *HandleHTTPRequest) (*HandleHTTPResponse, error)
}
PluginHTTPServer is the server interface plugins implement to own HTTP routes.
type PluginHealthClient ¶
type PluginHealthClient interface {
Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
GetCapabilities(ctx context.Context, in *GetCapabilitiesRequest, opts ...grpc.CallOption) (*GetCapabilitiesResponse, error)
}
func NewPluginHealthClient ¶
func NewPluginHealthClient(cc grpc.ClientConnInterface) PluginHealthClient
type PluginHealthServer ¶
type PluginHealthServer interface {
Health(context.Context, *HealthRequest) (*HealthResponse, error)
// GetCapabilities declares which optional extension points this plugin implements.
// Return an empty list (not an error) if the plugin has no extra capabilities.
GetCapabilities(context.Context, *GetCapabilitiesRequest) (*GetCapabilitiesResponse, error)
}
type PluginMiddlewareClient ¶
type PluginMiddlewareClient interface {
OnRequest(ctx context.Context, in *MiddlewareRequest, opts ...grpc.CallOption) (*MiddlewareResponse, error)
}
PluginMiddlewareClient is implemented by plugins that declare CapabilityAPIMiddleware. The platform calls OnRequest before every authenticated HTTP handler.
func NewPluginMiddlewareClient ¶
func NewPluginMiddlewareClient(cc grpc.ClientConnInterface) PluginMiddlewareClient
type PluginMiddlewareServer ¶
type PluginMiddlewareServer interface {
OnRequest(context.Context, *MiddlewareRequest) (*MiddlewareResponse, error)
}
PluginMiddlewareServer is the server interface plugins implement to intercept requests.
type PluginUIClient ¶
type PluginUIClient interface {
GetUIManifest(ctx context.Context, in *GetUIManifestRequest, opts ...grpc.CallOption) (*GetUIManifestResponse, error)
}
PluginUIClient is implemented by plugins that declare CapabilityUIManifest. The platform calls GetUIManifest to collect nav items and settings pages to surface in the panel.
func NewPluginUIClient ¶
func NewPluginUIClient(cc grpc.ClientConnInterface) PluginUIClient
type PluginUIServer ¶
type PluginUIServer interface {
GetUIManifest(context.Context, *GetUIManifestRequest) (*GetUIManifestResponse, error)
}
PluginUIServer is the server interface plugins implement to contribute UI.
type ProfileSection ¶
type ProfileSection struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
// IframeURL, if set, embeds the URL in an iframe inside the section card.
IframeURL string `json:"iframe_url,omitempty"`
// Actions lists the native actions this section supports (e.g. "change_password").
// The panel renders built-in Kleff-styled forms for each declared action.
Actions []string `json:"actions,omitempty"`
}
ProfileSection is a plugin-contributed section rendered on the user settings page.
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
RefreshToken string `json:"refresh_token"`
}
type RefreshTokenResponse ¶
type RefreshTokenResponse struct {
Token *TokenSet `json:"token,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type RegisterRequest ¶
type RegisterResponse ¶
type RegisterResponse struct {
UserID string `json:"user_id,omitempty"`
Error *PluginError `json:"error,omitempty"`
}
type RevokeSessionRequest ¶
type RevokeSessionResponse ¶
type RevokeSessionResponse struct {
Error *PluginError `json:"error,omitempty"`
}
type Route ¶
type Route struct {
Method string `json:"method"` // HTTP method ("GET", "POST", …) or "*" for any
Path string `json:"path"` // exact path or prefix ending in "*" (e.g. "/api/v1/auth/*")
Public bool `json:"public"` // reserved for future use; all auth is handled by plugin middleware
}
Route declares one HTTP endpoint the plugin wants to own. The platform will intercept matching requests and forward them via Handle.
type Session ¶
type Session struct {
ID string `json:"id"`
IPAddress string `json:"ip_address,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
StartedAt int64 `json:"started_at,omitempty"` // unix seconds
LastAccess int64 `json:"last_access,omitempty"` // unix seconds
Current bool `json:"current"`
}
Session represents one active login session for a user.
type SettingsPage ¶
type SettingsPage struct {
Label string `json:"label"`
Path string `json:"path"` // panel route, e.g. /settings/keycloak
IframeURL string `json:"iframe_url,omitempty"` // if set, embed as iframe
}
SettingsPage represents a settings page contributed by a plugin. If IframeURL is set the panel embeds it; otherwise it renders an empty shell.
type SignupConfig ¶
type SignupConfig struct {
// Disabled replaces the signup form with a message directing the user to
// register through the identity provider directly.
Disabled bool `json:"disabled,omitempty"`
// HideFirstName omits the first-name field.
HideFirstName bool `json:"hide_first_name,omitempty"`
// HideLastName omits the last-name field.
HideLastName bool `json:"hide_last_name,omitempty"`
// HideUsername omits the username field.
HideUsername bool `json:"hide_username,omitempty"`
}
SignupConfig lets an IDP plugin customise the self-registration page.
type TokenClaims ¶
type TokenClaims struct {
Subject string `json:"subject"`
Username string `json:"username,omitempty"`
Email string `json:"email,omitempty"`
Roles []string `json:"roles,omitempty"`
}
TokenClaims carries the verified identity extracted from a token.
type UIManifest ¶
type UIManifest struct {
PluginID string `json:"plugin_id"`
SettingsPages []*SettingsPage `json:"settings_pages,omitempty"`
LoginConfig *LoginConfig `json:"login_config,omitempty"`
SignupConfig *SignupConfig `json:"signup_config,omitempty"`
ProfileSections []*ProfileSection `json:"profile_sections,omitempty"`
}
UIManifest aggregates all UI contributions from a single plugin.
type UnimplementedIdentityPluginServer ¶
type UnimplementedIdentityPluginServer struct{}
func (UnimplementedIdentityPluginServer) ChangePassword ¶
func (UnimplementedIdentityPluginServer) ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error)
func (UnimplementedIdentityPluginServer) EnsureAdmin ¶
func (UnimplementedIdentityPluginServer) EnsureAdmin(context.Context, *EnsureAdminRequest) (*EnsureAdminResponse, error)
func (UnimplementedIdentityPluginServer) GetOIDCConfig ¶
func (UnimplementedIdentityPluginServer) GetOIDCConfig(context.Context, *GetOIDCConfigRequest) (*GetOIDCConfigResponse, error)
func (UnimplementedIdentityPluginServer) GetUser ¶
func (UnimplementedIdentityPluginServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error)
func (UnimplementedIdentityPluginServer) Health ¶
func (UnimplementedIdentityPluginServer) Health(context.Context, *HealthRequest) (*HealthResponse, error)
func (UnimplementedIdentityPluginServer) ListSessions ¶
func (UnimplementedIdentityPluginServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
func (UnimplementedIdentityPluginServer) Login ¶
func (UnimplementedIdentityPluginServer) Login(context.Context, *LoginRequest) (*LoginResponse, error)
func (UnimplementedIdentityPluginServer) RefreshToken ¶
func (UnimplementedIdentityPluginServer) RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
func (UnimplementedIdentityPluginServer) Register ¶
func (UnimplementedIdentityPluginServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
func (UnimplementedIdentityPluginServer) RevokeSession ¶
func (UnimplementedIdentityPluginServer) RevokeSession(context.Context, *RevokeSessionRequest) (*RevokeSessionResponse, error)
func (UnimplementedIdentityPluginServer) ValidateToken ¶
func (UnimplementedIdentityPluginServer) ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
type UnimplementedPluginHTTPServer ¶
type UnimplementedPluginHTTPServer struct{}
func (UnimplementedPluginHTTPServer) GetRoutes ¶
func (UnimplementedPluginHTTPServer) GetRoutes(context.Context, *GetRoutesRequest) (*GetRoutesResponse, error)
func (UnimplementedPluginHTTPServer) Handle ¶
func (UnimplementedPluginHTTPServer) Handle(context.Context, *HandleHTTPRequest) (*HandleHTTPResponse, error)
type UnimplementedPluginHealthServer ¶
type UnimplementedPluginHealthServer struct{}
func (UnimplementedPluginHealthServer) GetCapabilities ¶
func (UnimplementedPluginHealthServer) GetCapabilities(context.Context, *GetCapabilitiesRequest) (*GetCapabilitiesResponse, error)
func (UnimplementedPluginHealthServer) Health ¶
func (UnimplementedPluginHealthServer) Health(context.Context, *HealthRequest) (*HealthResponse, error)
type UnimplementedPluginMiddlewareServer ¶
type UnimplementedPluginMiddlewareServer struct{}
func (UnimplementedPluginMiddlewareServer) OnRequest ¶
func (UnimplementedPluginMiddlewareServer) OnRequest(context.Context, *MiddlewareRequest) (*MiddlewareResponse, error)
type UnimplementedPluginUIServer ¶
type UnimplementedPluginUIServer struct{}
func (UnimplementedPluginUIServer) GetUIManifest ¶
func (UnimplementedPluginUIServer) GetUIManifest(context.Context, *GetUIManifestRequest) (*GetUIManifestResponse, error)
type ValidateTokenRequest ¶
type ValidateTokenRequest struct {
Token string `json:"token"`
}
type ValidateTokenResponse ¶
type ValidateTokenResponse struct {
Claims *TokenClaims `json:"claims,omitempty"`
Error *PluginError `json:"error,omitempty"`
}