Documentation
¶
Index ¶
- type Client
- type ClientCollection
- func (c *ClientCollection) Create(ctx context.Context, client *Client) error
- func (c *ClientCollection) Delete(ctx context.Context, clientID string) error
- func (c *ClientCollection) GetByClientID(ctx context.Context, clientID string) (*Client, error)
- func (c *ClientCollection) Update(ctx context.Context, client *Client) error
- type ClientStore
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Core OAuth 2.0 / OIDC fields
ClientID string `bson:"client_id" json:"client_id"`
ClientSecretHash string `bson:"client_secret_hash,omitempty" json:"-"`
RedirectURIs []string `bson:"redirect_uris" json:"redirect_uris"`
GrantTypes []string `bson:"grant_types" json:"grant_types"`
ResponseTypes []string `bson:"response_types" json:"response_types"`
TokenEndpointAuthMethod string `bson:"token_endpoint_auth_method" json:"token_endpoint_auth_method"`
AllowedScopes []string `bson:"allowed_scopes" json:"allowed_scopes"`
DefaultScopes []string `bson:"default_scopes,omitempty" json:"default_scopes,omitempty"`
SubjectType string `bson:"subject_type" json:"subject_type"` // "public" or "pairwise"
JWKSUri string `bson:"jwks_uri,omitempty" json:"jwks_uri,omitempty"`
JWKS any `bson:"jwks,omitempty" json:"jwks,omitempty"`
RequirePKCE bool `bson:"require_pkce" json:"require_pkce"`
RequireCodeChallenge bool `bson:"require_code_challenge" json:"require_code_challenge"`
// RFC 7591 Client Metadata (optional fields)
ClientName string `bson:"client_name,omitempty" json:"client_name,omitempty"`
ClientURI string `bson:"client_uri,omitempty" json:"client_uri,omitempty"`
LogoURI string `bson:"logo_uri,omitempty" json:"logo_uri,omitempty"`
Contacts []string `bson:"contacts,omitempty" json:"contacts,omitempty"`
TosURI string `bson:"tos_uri,omitempty" json:"tos_uri,omitempty"`
PolicyURI string `bson:"policy_uri,omitempty" json:"policy_uri,omitempty"`
SoftwareID string `bson:"software_id,omitempty" json:"software_id,omitempty"`
SoftwareVersion string `bson:"software_version,omitempty" json:"software_version,omitempty"`
ApplicationType string `bson:"application_type,omitempty" json:"application_type,omitempty"` // "web" or "native"
SectorIdentifierURI string `bson:"sector_identifier_uri,omitempty" json:"sector_identifier_uri,omitempty"`
IDTokenSignedResponseAlg string `bson:"id_token_signed_response_alg,omitempty" json:"id_token_signed_response_alg,omitempty"`
DefaultMaxAge int `bson:"default_max_age,omitempty" json:"default_max_age,omitempty"`
RequireAuthTime bool `bson:"require_auth_time,omitempty" json:"require_auth_time,omitempty"`
DefaultACRValues []string `bson:"default_acr_values,omitempty" json:"default_acr_values,omitempty"`
InitiateLoginURI string `bson:"initiate_login_uri,omitempty" json:"initiate_login_uri,omitempty"`
RequestURIs []string `bson:"request_uris,omitempty" json:"request_uris,omitempty"`
// RFC 7636 PKCE metadata
CodeChallengeMethod string `bson:"code_challenge_method,omitempty" json:"code_challenge_method,omitempty"`
// RFC 7592 Client Management
RegistrationAccessTokenHash string `bson:"registration_access_token_hash,omitempty" json:"-"`
ClientIDIssuedAt int64 `bson:"client_id_issued_at,omitempty" json:"client_id_issued_at,omitempty"`
ClientSecretExpiresAt int64 `bson:"client_secret_expires_at,omitempty" json:"client_secret_expires_at,omitempty"`
}
Client represents an OIDC client (Relying Party) Implements RFC 7591 (OAuth 2.0 Dynamic Client Registration Protocol) and RFC 7592 (OAuth 2.0 Dynamic Client Registration Management Protocol)
type ClientCollection ¶
type ClientCollection struct {
Service *Service
// contains filtered or unexported fields
}
ClientCollection provides database operations for clients
func (*ClientCollection) Create ¶
func (c *ClientCollection) Create(ctx context.Context, client *Client) error
Create creates a new client
func (*ClientCollection) Delete ¶
func (c *ClientCollection) Delete(ctx context.Context, clientID string) error
Delete deletes a client
func (*ClientCollection) GetByClientID ¶
GetByClientID retrieves a client by client ID
type ClientStore ¶
type ClientStore interface {
GetByClientID(ctx context.Context, clientID string) (*Client, error)
Create(ctx context.Context, client *Client) error
Update(ctx context.Context, client *Client) error
Delete(ctx context.Context, clientID string) error
}
ClientStore defines the interface for OIDC client operations
type Service ¶
type Service struct {
MongoClient *mongo.Client
// OIDC client collection, client registration
Clients ClientStore
// contains filtered or unexported fields
}
Service is the database service
func New ¶
func New(ctx context.Context, cfg *model.Cfg, tracer *trace.Tracer, log *logger.Log) (*Service, error)
New creates a new database service
func NewServiceWithMocks ¶
func NewServiceWithMocks(clients ClientStore) *Service
NewServiceWithMocks creates a db.Service with mock implementations for testing This allows unit tests to inject mock ClientStore implementation
func (*Service) Status ¶
func (s *Service) Status(ctx context.Context) *apiv1_status.StatusProbe
Status returns the status of the database