feat: add possibility to add verifier opts to default RP

This commit is contained in:
Livio Amstutz 2020-09-10 15:19:55 +02:00
parent f645dd3543
commit 8f07a5b9c9

View file

@ -41,6 +41,7 @@ type DefaultRP struct {
errorHandler func(http.ResponseWriter, *http.Request, string, string, string)
verifier Verifier
verifierOpts []ConfFunc
onlyOAuth2 bool
}
@ -79,7 +80,7 @@ func NewDefaultRP(rpConfig *Config, rpOpts ...DefaultRPOpts) (DelegationTokenExc
}
if p.verifier == nil {
p.verifier = NewDefaultVerifier(rpConfig.Issuer, rpConfig.ClientID, NewRemoteKeySet(p.httpClient, p.endpoints.JKWsURL))
p.verifier = NewDefaultVerifier(rpConfig.Issuer, rpConfig.ClientID, NewRemoteKeySet(p.httpClient, p.endpoints.JKWsURL), p.verifierOpts...)
}
return p, nil
@ -112,6 +113,12 @@ func WithHTTPClient(client *http.Client) DefaultRPOpts {
}
}
func WithVerifierOpts(opts ...ConfFunc) DefaultRPOpts {
return func(p *DefaultRP) {
p.verifierOpts = opts
}
}
//AuthURL is the `RelayingParty` interface implementation
//wrapping the oauth2 `AuthCodeURL`
//returning the url of the auth request