FetchMetadata returns metadata from an IDP metadata URL. If httpClient is nil, a client with a two-minute timeout is used. Only a 2xx response is accepted. The metadata names the certificates the service provider trusts to sign assertions, so whoever controls the response controls who can log in.
(ctx context.Context, httpClient *http.Client, metadataURL url.URL)
| 263 | // is not authenticated beyond what httpClient does: use an https URL, and |
| 264 | // prefer FetchSignedMetadata, or metadata kept with the application. |
| 265 | func FetchMetadata(ctx context.Context, httpClient *http.Client, metadataURL url.URL) (*saml.EntityDescriptor, error) { |
| 266 | data, err := fetchMetadataBytes(ctx, httpClient, metadataURL) |
| 267 | if err != nil { |
| 268 | return nil, err |
| 269 | } |
| 270 | return ParseMetadata(data) |
| 271 | } |
| 272 | |
| 273 | // FetchMetadataByEntityID fetches metadata from metadataURL and returns the |
| 274 | // entity whose entityID is entityID. Use it to select an IDP from aggregate |