Merge pull request #54 from caos/verifier-opts

feat: add possibility to add verifier opts to default RP
This commit is contained in:
Fabi 2020-09-10 15:42:05 +02:00 committed by GitHub
commit bcb6acbef1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,8 +40,9 @@ type DefaultRP struct {
errorHandler func(http.ResponseWriter, *http.Request, string, string, string)
verifier Verifier
onlyOAuth2 bool
verifier Verifier
verifierOpts []ConfFunc
onlyOAuth2 bool
}
//NewDefaultRP creates `DefaultRP` with the given
@ -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