rp Discover use client.Discover

This commit is contained in:
wener 2021-10-08 00:16:24 +08:00
parent 55e2b05fd8
commit 79ead65710

View file

@ -170,17 +170,18 @@ func NewRelyingPartyOIDC(issuer, clientID, clientSecret, redirectURI string, sco
return nil, err return nil, err
} }
} }
endpoints, err := Discover(rp.issuer, rp.httpClient) discoveryConfiguration, err := client.Discover(rp.issuer, rp.httpClient)
if err != nil { if err != nil {
return nil, err return nil, err
} }
endpoints := GetEndpoints(discoveryConfiguration)
rp.oauthConfig.Endpoint = endpoints.Endpoint rp.oauthConfig.Endpoint = endpoints.Endpoint
rp.endpoints = endpoints rp.endpoints = endpoints
return rp, nil return rp, nil
} }
//DefaultRPOpts is the type for providing dynamic options to the DefaultRP //Option is the type for providing dynamic options to the DefaultRP
type Option func(*relyingParty) error type Option func(*relyingParty) error
//WithCookieHandler set a `CookieHandler` for securing the various redirects //WithCookieHandler set a `CookieHandler` for securing the various redirects