added CanGetPrivateClaimsFromRequest interface to serve the same purpose as CanSetUserinfoFromRequest, a simple interface for building tokens based on the auth request

This commit is contained in:
BitMasher 2025-02-24 20:30:50 -06:00
parent 4ef9529012
commit 59b7ae254d
2 changed files with 11 additions and 1 deletions

View file

@ -144,6 +144,12 @@ type CanSetUserinfoFromRequest interface {
SetUserinfoFromRequest(ctx context.Context, userinfo *oidc.UserInfo, request IDTokenRequest, scopes []string) error
}
// CanGetPrivateClaimsFromRequest is an optional additional interface that may be implemented by
// implementors of Storage. It allows setting the jwt token claims based on the request.
type CanGetPrivateClaimsFromRequest interface {
GetPrivateClaimsFromRequest(ctx context.Context, request TokenRequest, restrictedScopes []string) (map[string]any, error)
}
// Storage is a required parameter for NewOpenIDProvider(). In addition to the
// embedded interfaces below, if the passed Storage implements ClientCredentialsStorage
// then the grant type "client_credentials" will be supported. In that case, the access