Documentation
¶
Index ¶
- type Config
- type CreateJWTKeyRequest
- type ErrorResponse
- type GenerateTokenRequest
- type Handler
- type ListJWTKeysRequest
- type Plugin
- func (p *Plugin) GetHandler() *Handler
- func (p *Plugin) ID() string
- func (p *Plugin) Init(authInst core.Authsome) error
- func (p *Plugin) Migrate() error
- func (p *Plugin) RegisterHooks(_ *hooks.HookRegistry) error
- func (p *Plugin) RegisterRoutes(router forge.Router) error
- func (p *Plugin) RegisterServiceDecorators(_ *registry.ServiceRegistry) error
- type PluginOption
- type VerifyTokenRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Issuer is the JWT issuer claim
Issuer string `json:"issuer"`
// AccessExpirySeconds is the access token expiry in seconds
AccessExpirySeconds int `json:"accessExpirySeconds"`
// RefreshExpirySeconds is the refresh token expiry in seconds
RefreshExpirySeconds int `json:"refreshExpirySeconds"`
// SigningAlgorithm is the JWT signing algorithm (HS256, RS256, etc.)
SigningAlgorithm string `json:"signingAlgorithm"`
// IncludeAppIDClaim includes app_id in JWT claims
IncludeAppIDClaim bool `json:"includeAppIDClaim"`
}
Config holds the JWT plugin configuration
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default JWT plugin configuration
type CreateJWTKeyRequest ¶ added in v0.0.7
type CreateJWTKeyRequest struct {
IsPlatformKey bool `json:"isPlatformKey"`
Algorithm string `json:"algorithm" validate:"required"`
KeyType string `json:"keyType" validate:"required"`
Curve string `json:"curve"`
ExpiresAt *time.Time `json:"expiresAt"`
Metadata map[string]interface{} `json:"metadata"`
}
Request types
type ErrorResponse ¶
type ErrorResponse = responses.ErrorResponse
ErrorResponse represents an error response for JWT operations - use shared response from core
type GenerateTokenRequest ¶ added in v0.0.7
type GenerateTokenRequest struct {
UserID string `json:"userId" validate:"required"`
SessionID string `json:"sessionId"`
TokenType string `json:"tokenType" validate:"required"`
Scopes []string `json:"scopes"`
Permissions []string `json:"permissions"`
Audience []string `json:"audience"`
ExpiresIn time.Duration `json:"expiresIn"`
Metadata map[string]interface{} `json:"metadata"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles JWT-related HTTP requests
func NewHandler ¶
NewHandler creates a new JWT handler
func (*Handler) CreateJWTKey ¶
CreateJWTKey creates a new JWT signing key
func (*Handler) GenerateToken ¶
GenerateToken generates a new JWT token
func (*Handler) ListJWTKeys ¶
ListJWTKeys lists JWT signing keys
type ListJWTKeysRequest ¶ added in v0.0.7
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the JWT authentication plugin
func NewPlugin ¶
func NewPlugin(opts ...PluginOption) *Plugin
NewPlugin creates a new JWT plugin instance with optional configuration
func (*Plugin) GetHandler ¶
GetHandler returns the JWT handler
func (*Plugin) Migrate ¶
Migrate runs plugin migrations (no-op for JWT - migrations handled at app level)
func (*Plugin) RegisterHooks ¶
func (p *Plugin) RegisterHooks(_ *hooks.HookRegistry) error
RegisterHooks registers plugin hooks (no-op for JWT)
func (*Plugin) RegisterRoutes ¶
RegisterRoutes registers the JWT plugin's HTTP routes
func (*Plugin) RegisterServiceDecorators ¶
func (p *Plugin) RegisterServiceDecorators(_ *registry.ServiceRegistry) error
RegisterServiceDecorators registers service decorators (no-op for JWT)
type PluginOption ¶
type PluginOption func(*Plugin)
PluginOption is a functional option for configuring the JWT plugin
func WithAccessExpiry ¶
func WithAccessExpiry(seconds int) PluginOption
WithAccessExpiry sets the access token expiry
func WithDefaultConfig ¶
func WithDefaultConfig(cfg Config) PluginOption
WithDefaultConfig sets the default configuration for the plugin
func WithIncludeAppIDClaim ¶
func WithIncludeAppIDClaim(include bool) PluginOption
WithIncludeAppIDClaim sets whether to include app_id claim
func WithRefreshExpiry ¶
func WithRefreshExpiry(seconds int) PluginOption
WithRefreshExpiry sets the refresh token expiry
func WithSigningAlgorithm ¶
func WithSigningAlgorithm(algorithm string) PluginOption
WithSigningAlgorithm sets the signing algorithm