feat(op): add support for client credentials

This commit is contained in:
Livio Spring 2023-01-30 10:54:22 +01:00
parent 2574ebc6e7
commit 90b99d4d2b
No known key found for this signature in database
GPG key ID: 26BB1C2FA5952CF0
8 changed files with 145 additions and 2 deletions

View file

@ -18,6 +18,7 @@ type Exchanger interface {
GrantTypeRefreshTokenSupported() bool
GrantTypeTokenExchangeSupported() bool
GrantTypeJWTAuthorizationSupported() bool
GrantTypeClientCredentialsSupported() bool
}
func tokenHandler(exchanger Exchanger) func(w http.ResponseWriter, r *http.Request) {
@ -42,6 +43,11 @@ func tokenHandler(exchanger Exchanger) func(w http.ResponseWriter, r *http.Reque
TokenExchange(w, r, exchanger)
return
}
case string(oidc.GrantTypeClientCredentials):
if exchanger.GrantTypeClientCredentialsSupported() {
ClientCredentialsExchange(w, r, exchanger)
return
}
case "":
RequestError(w, r, oidc.ErrInvalidRequest().WithDescription("grant_type missing"))
return