Made it possible to override certain example IDP endpoints

This commit is contained in:
David J. Allen 2024-04-29 18:45:30 -06:00
parent f10a771db6
commit 73e4e50d44
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
4 changed files with 57 additions and 18 deletions

View file

@ -164,3 +164,25 @@ func (p *IdentityProvider) FetchJwks() error {
return nil
}
func (p *IdentityProvider) UpdateEndpoints(other *IdentityProvider) {
UpdateEndpoints(&p.Endpoints, &other.Endpoints)
}
func UpdateEndpoints(eps *Endpoints, other *Endpoints) {
// only update endpoints that are not empty
var UpdateIf = func(ep *string, s string) {
if ep != nil {
if *ep != "" {
*ep = s
}
}
}
UpdateIf(&eps.Config, other.Config)
UpdateIf(&eps.Authorization, other.Authorization)
UpdateIf(&eps.Token, other.Token)
UpdateIf(&eps.Revocation, other.Revocation)
UpdateIf(&eps.Introspection, other.Introspection)
UpdateIf(&eps.UserInfo, other.UserInfo)
UpdateIf(&eps.JwksUri, other.JwksUri)
}