Documentation
¶
Overview ¶
Package consent persists consent challenges and verifiers. Queries are generated by sqlc into the sqlcgen subpackage and re-exported here via type aliases.
Index ¶
- Variables
- type AcceptConsentRequest
- type ConsentChallenge
- type ConsentChallengeRow
- type CreateConsentChallengeParams
- type GrpcHandler
- func (h *GrpcHandler) Accept(ctx context.Context, req *proto.ConsentServiceAcceptRequest) (*proto.ConsentServiceAcceptResponse, error)
- func (h *GrpcHandler) Get(ctx context.Context, req *proto.ConsentServiceGetRequest) (*proto.ConsentServiceGetResponse, error)
- func (h *GrpcHandler) Reject(ctx context.Context, req *proto.ConsentServiceRejectRequest) (*proto.ConsentServiceRejectResponse, error)
- type Manager
- func (m *Manager) AcceptChallenge(ctx context.Context, challengeID string, acceptRequest *AcceptConsentRequest) (*ConsentChallenge, error)
- func (m *Manager) CreateChallenge(ctx context.Context, loginChallengeID string) (*ConsentChallenge, error)
- func (m *Manager) GetChallenge(ctx context.Context, challenge string) (*ConsentChallenge, error)
- func (m *Manager) InitiateConsentFlow(ctx context.Context, loginChallengeID string) (string, string, error)
- func (m *Manager) RedirectURLFor(challenge *ConsentChallenge) string
- func (m *Manager) RejectChallenge(ctx context.Context, challengeID string) (*ConsentChallenge, error)
- func (m *Manager) ResolveVerifier(ctx context.Context, verifier, csrfToken string) (*ConsentChallenge, error)
- type Querier
- type Queries
- type UpdateConsentChallengeVerifierParams
Constants ¶
This section is empty.
Variables ¶
var CSRFCookie = csrf.NewCookie("iam_consent_csrf")
var ErrConsentRejected = errors.New("consent request denied by resource owner")
ErrConsentRejected is returned by ResolveVerifier when the resource owner denied the consent request.
var New = sqlcgen.New
Functions ¶
This section is empty.
Types ¶
type AcceptConsentRequest ¶
type AcceptConsentRequest struct {
GrantedScopes []string `json:"granted_scopes"`
}
type ConsentChallenge ¶
type ConsentChallenge struct {
ID string
LoginChallengeID string
ClientID string
CodeChallenge string
CodeChallengeMethod string
ResponseType string
RequestedScopes []string
RedirectURI string
State string
Subject string
CSRFToken string
CreatedAt time.Time
ExpiresAt time.Time
VerifierID string
GrantedScopes []string
Rejected bool
VerifierExpiresAt time.Time
Consumed bool
}
ConsentChallenge carries the consent row joined with its parent login_challenges row. The OAuth request envelope (client_id, code_challenge, requested_scopes, redirect_uri, state, subject, ...) lives on login_challenges; consent_challenges itself stores only consent-specific columns. See iam-consent-persistence-plan.md addendum.
func (*ConsentChallenge) AcceptVerifier ¶ added in v1.10.0
func (*ConsentChallenge) Consume ¶ added in v1.10.0
func (c *ConsentChallenge) Consume() error
func (*ConsentChallenge) RejectVerifier ¶ added in v1.10.0
func (c *ConsentChallenge) RejectVerifier(verifierID string, lifespan time.Duration) error
type ConsentChallengeRow ¶ added in v1.10.0
type ConsentChallengeRow = sqlcgen.GetConsentChallengeByIDRow
ConsentChallengeRow is the canonical joined-row type returned by the three GetConsentChallenge* queries. sqlc emits one row type per query (all structurally identical); callers convert via ConsentChallengeRow(row).
type CreateConsentChallengeParams ¶ added in v1.10.0
type CreateConsentChallengeParams = sqlcgen.CreateConsentChallengeParams
type GrpcHandler ¶ added in v1.10.0
type GrpcHandler struct {
proto.UnimplementedConsentServiceServer
// contains filtered or unexported fields
}
GrpcHandler serves the Consent gRPC service backed by the consent Manager and the OAuth client registry.
func NewGrpcHandler ¶ added in v1.10.0
func NewGrpcHandler(clientManager *clients.Registry, manager *Manager) *GrpcHandler
NewGrpcHandler returns a GrpcHandler that resolves clients via clientManager and stores/retrieves consent challenges via manager.
func (*GrpcHandler) Accept ¶ added in v1.10.0
func (h *GrpcHandler) Accept(ctx context.Context, req *proto.ConsentServiceAcceptRequest) (*proto.ConsentServiceAcceptResponse, error)
func (*GrpcHandler) Get ¶ added in v1.10.0
func (h *GrpcHandler) Get(ctx context.Context, req *proto.ConsentServiceGetRequest) (*proto.ConsentServiceGetResponse, error)
func (*GrpcHandler) Reject ¶ added in v1.10.0
func (h *GrpcHandler) Reject(ctx context.Context, req *proto.ConsentServiceRejectRequest) (*proto.ConsentServiceRejectResponse, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(cfg authConfig.Config, db storage.Database) *Manager
func (*Manager) AcceptChallenge ¶
func (m *Manager) AcceptChallenge(ctx context.Context, challengeID string, acceptRequest *AcceptConsentRequest) (*ConsentChallenge, error)
func (*Manager) CreateChallenge ¶
func (*Manager) GetChallenge ¶
func (*Manager) InitiateConsentFlow ¶
func (*Manager) RedirectURLFor ¶ added in v1.10.0
func (m *Manager) RedirectURLFor(challenge *ConsentChallenge) string
func (*Manager) RejectChallenge ¶
func (*Manager) ResolveVerifier ¶
type UpdateConsentChallengeVerifierParams ¶ added in v1.10.0
type UpdateConsentChallengeVerifierParams = sqlcgen.UpdateConsentChallengeVerifierParams