@@ -11,6 +11,8 @@ import (
1111 "strings"
1212 "time"
1313
14+ "github.com/pkg/errors"
15+
1416 "github.com/ory/x/hasherx"
1517
1618 "github.com/gofrs/uuid"
@@ -50,7 +52,8 @@ const (
5052 KeySubjectTypesSupported = "oidc.subject_identifiers.supported_types"
5153 KeyDefaultClientScope = "oidc.dynamic_client_registration.default_scope"
5254 KeyDSN = "dsn"
53- ViperKeyClientHTTPNoPrivateIPRanges = "clients.http.disallow_private_ip_ranges"
55+ KeyClientHTTPNoPrivateIPRanges = "clients.http.disallow_private_ip_ranges"
56+ KeyClientHTTPPrivateIPExceptionURLs = "clients.http.private_ip_exception_urls"
5457 KeyHasherAlgorithm = "oauth2.hashers.algorithm"
5558 KeyBCryptCost = "oauth2.hashers.bcrypt.cost"
5659 KeyPBKDF2Iterations = "oauth2.hashers.pbkdf2.iterations"
@@ -80,7 +83,8 @@ const (
8083 KeyPublicURL = "urls.self.public"
8184 KeyAdminURL = "urls.self.admin"
8285 KeyIssuerURL = "urls.self.issuer"
83- KeyIdentityProviderAdminURL = "urls.identity_provider.admin_base_url"
86+ KeyIdentityProviderAdminURL = "urls.identity_provider.url"
87+ KeyIdentityProviderHeaders = "urls.identity_provider.headers"
8488 KeyAccessTokenStrategy = "strategies.access_token"
8589 KeyJWTScopeClaimStrategy = "strategies.jwt.scope_claim"
8690 KeyDBIgnoreUnknownTableColumns = "db.ignore_unknown_table_columns"
@@ -200,7 +204,11 @@ func (p *DefaultProvider) WellKnownKeys(ctx context.Context, include ...string)
200204}
201205
202206func (p * DefaultProvider ) ClientHTTPNoPrivateIPRanges () bool {
203- return p .getProvider (contextx .RootContext ).Bool (ViperKeyClientHTTPNoPrivateIPRanges )
207+ return p .getProvider (contextx .RootContext ).Bool (KeyClientHTTPNoPrivateIPRanges )
208+ }
209+
210+ func (p * DefaultProvider ) ClientHTTPPrivateIPExceptionURLs () []string {
211+ return p .getProvider (contextx .RootContext ).Strings (KeyClientHTTPPrivateIPExceptionURLs )
204212}
205213
206214func (p * DefaultProvider ) AllowedTopLevelClaims (ctx context.Context ) []string {
@@ -401,6 +409,21 @@ func (p *DefaultProvider) KratosAdminURL(ctx context.Context) (*url.URL, bool) {
401409
402410 return u , u != nil
403411}
412+ func (p * DefaultProvider ) KratosRequestHeader (ctx context.Context ) http.Header {
413+ hh := map [string ]string {}
414+ if err := p .getProvider (ctx ).Unmarshal (KeyIdentityProviderHeaders , & hh ); err != nil {
415+ p .l .WithError (errors .WithStack (err )).
416+ Errorf ("Configuration value from key %s could not be decoded." , KeyIdentityProviderHeaders )
417+ return nil
418+ }
419+
420+ h := make (http.Header )
421+ for k , v := range hh {
422+ h .Set (k , v )
423+ }
424+
425+ return h
426+ }
404427
405428func (p * DefaultProvider ) OAuth2ClientRegistrationURL (ctx context.Context ) * url.URL {
406429 return p .getProvider (ctx ).RequestURIF (KeyOAuth2ClientRegistrationURL , new (url.URL ))
0 commit comments