Documentation
¶
Overview ¶
Package handler implements the HTTP handlers.
Index ¶
- type AutojoinHandler
- type AutojoinKeyVerifier
- type AutojoinRequest
- type AutojoinResponse
- type AutojoinTokenGenerator
- type ClientIntegrationHandler
- type ClientIntegrationKeyVerifier
- type ClientIntegrationRequest
- type ClientIntegrationResponse
- type ClientIntegrationTokenGenerator
- type JWKSHandler
- type PublicKeyProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutojoinHandler ¶ added in v0.3.0
type AutojoinHandler struct {
// contains filtered or unexported fields
}
AutojoinHandler handles the exchange of API keys for JWTs.
func NewAutojoinHandler ¶ added in v0.3.0
func NewAutojoinHandler(jwtSigner AutojoinTokenGenerator, store AutojoinKeyVerifier) *AutojoinHandler
NewAutojoinHandler creates a new *AutojoinHandler with the provided token generator and key verifier.
func (*AutojoinHandler) Exchange ¶ added in v0.3.0
func (h *AutojoinHandler) Exchange(w http.ResponseWriter, r *http.Request)
Exchange handles HTTP requests to exchange API keys for JWT tokens. It validates the API key and returns a JWT token for the associated organization.
type AutojoinKeyVerifier ¶ added in v0.3.0
type AutojoinKeyVerifier interface {
ValidateKey(ctx context.Context, apiKey string) (string, error)
}
AutojoinKeyVerifier defines the interface for validating API keys and retrieving organization information.
type AutojoinRequest ¶ added in v0.3.0
type AutojoinRequest struct {
APIKey string `json:"api_key"`
}
AutojoinRequest represents the request payload for token exchange.
type AutojoinResponse ¶ added in v0.3.0
AutojoinResponse represents the response payload containing the generated token.
type AutojoinTokenGenerator ¶ added in v0.3.0
type AutojoinTokenGenerator interface {
GenerateAutojoinToken(org string, expiry time.Duration, audience ...string) (string, error)
}
AutojoinTokenGenerator defines the interface for generating autojoin authentication tokens.
type ClientIntegrationHandler ¶ added in v0.3.0
type ClientIntegrationHandler struct {
// contains filtered or unexported fields
}
ClientIntegrationHandler exchanges integration API keys for short-lived JWTs.
func NewClientIntegrationHandler ¶ added in v0.3.0
func NewClientIntegrationHandler( jwtSigner ClientIntegrationTokenGenerator, store ClientIntegrationKeyVerifier) *ClientIntegrationHandler
NewClientIntegrationHandler creates a new *ClientIntegrationHandler with the provided token generator and key verifier.
func (*ClientIntegrationHandler) Exchange ¶ added in v0.3.0
func (h *ClientIntegrationHandler) Exchange(w http.ResponseWriter, r *http.Request)
Exchange handles HTTP requests to exchange integrator API keys for JWT tokens.
It validates the API key and returns a JWT token for the associated client integration.
This method is thread safe.
type ClientIntegrationKeyVerifier ¶ added in v0.3.0
type ClientIntegrationKeyVerifier interface {
ValidateKey(ctx context.Context, apiKey string) (integrationID string, keyID string, tier int, err error)
}
ClientIntegrationKeyVerifier defines the interface for validating API keys and retrieving the integration ID, key ID, and tier.
type ClientIntegrationRequest ¶ added in v0.3.0
type ClientIntegrationRequest = AutojoinRequest
ClientIntegrationRequest represents the request payload for token exchanges pertaining the [clientIntegrationAudience].
type ClientIntegrationResponse ¶ added in v0.3.0
type ClientIntegrationResponse = AutojoinResponse
ClientIntegrationResponse represents the response payload containing the generated JWT for the [clientIntegrationAudience].
type ClientIntegrationTokenGenerator ¶ added in v0.3.0
type ClientIntegrationTokenGenerator interface {
GenerateClientIntegrationToken(integrationID, keyID string, tier int, expiry time.Duration, audience ...string) (string, error)
}
ClientIntegrationTokenGenerator defines the interface for generating client-integration authentication tokens.
type JWKSHandler ¶
type JWKSHandler struct {
// contains filtered or unexported fields
}
JWKSHandler handles serving JSON Web Key Set (JWKS) endpoints.
func NewJWKSHandler ¶
func NewJWKSHandler(jwtSigner PublicKeyProvider) *JWKSHandler
NewJWKSHandler creates a new JWKSHandler with the provided public key provider.
func (*JWKSHandler) ServeJWKS ¶
func (h *JWKSHandler) ServeJWKS(w http.ResponseWriter, r *http.Request)
ServeJWKS handles HTTP requests to serve the JSON Web Key Set (JWKS) containing public keys. It returns the public keys in JWKS format with appropriate caching headers.
type PublicKeyProvider ¶
type PublicKeyProvider interface {
GetPublicJWK() jose.JSONWebKey
}
PublicKeyProvider defines the interface for providing public keys in JWK format.