@@ -44,18 +44,20 @@ public class OidcProxy {
44
44
final OidcProxyConfig oidcProxyConfig ;
45
45
final WebClient client ;
46
46
final String configuredClientSecret ;
47
+ final String httpRootPath ;
47
48
48
- public OidcProxy (TenantConfigBean tenantConfig , OidcProxyConfig oidcProxyConfig ) {
49
+ public OidcProxy (TenantConfigBean tenantConfig , OidcProxyConfig oidcProxyConfig , String httpRootPath ) {
49
50
TenantConfigContext tenantConfigContext = oidcProxyConfig .tenantId ().isEmpty () ? tenantConfig .getDefaultTenant ()
50
51
: tenantConfig .getStaticTenantsConfig ().get (oidcProxyConfig .tenantId ().get ());
51
52
this .oidcTenantConfig = tenantConfigContext .getOidcTenantConfig ();
52
53
this .oidcMetadata = tenantConfigContext .getOidcMetadata ();
53
54
this .client = tenantConfigContext .getOidcProviderClient ().getWebClient ();
54
55
this .oidcProxyConfig = oidcProxyConfig ;
55
56
this .configuredClientSecret = OidcCommonUtils .clientSecret (oidcTenantConfig .credentials );
57
+ this .httpRootPath = httpRootPath ;
56
58
}
57
59
58
- public void setup (Router router , String httpRootPath ) {
60
+ public void setup (Router router ) {
59
61
if (oidcTenantConfig .applicationType .orElse (ApplicationType .SERVICE ) == ApplicationType .WEB_APP ) {
60
62
throw new ConfigurationException ("OIDC Proxy can only be used with OIDC service applications" );
61
63
}
@@ -72,16 +74,16 @@ public void setup(Router router, String httpRootPath) {
72
74
throw new ConfigurationException (
73
75
"Unsupported OIDC service client authentication method" );
74
76
}
75
- router .get (httpRootPath + oidcProxyConfig .rootPath () + OidcConstants .WELL_KNOWN_CONFIGURATION )
77
+ router .get (oidcProxyConfig .rootPath () + OidcConstants .WELL_KNOWN_CONFIGURATION )
76
78
.handler (this ::wellKnownConfig );
77
79
if (oidcMetadata .getJsonWebKeySetUri () != null ) {
78
- router .get (httpRootPath + oidcProxyConfig .rootPath () + oidcProxyConfig .jwksPath ()).handler (this ::jwks );
80
+ router .get (oidcProxyConfig .rootPath () + oidcProxyConfig .jwksPath ()).handler (this ::jwks );
79
81
}
80
82
if (oidcMetadata .getUserInfoUri () != null && oidcProxyConfig .allowIdToken ()) {
81
- router .get (httpRootPath + oidcProxyConfig .rootPath () + oidcProxyConfig .userInfoPath ()).handler (this ::userinfo );
83
+ router .get (oidcProxyConfig .rootPath () + oidcProxyConfig .userInfoPath ()).handler (this ::userinfo );
82
84
}
83
- router .get (httpRootPath + oidcProxyConfig .rootPath () + oidcProxyConfig .authorizationPath ()).handler (this ::authorize );
84
- router .post (httpRootPath + oidcProxyConfig .rootPath () + oidcProxyConfig .tokenPath ()).handler (this ::token );
85
+ router .get (oidcProxyConfig .rootPath () + oidcProxyConfig .authorizationPath ()).handler (this ::authorize );
86
+ router .post (oidcProxyConfig .rootPath () + oidcProxyConfig .tokenPath ()).handler (this ::token );
85
87
if (oidcTenantConfig .authentication .redirectPath .isPresent ()) {
86
88
if (!oidcProxyConfig .externalRedirectUri ().isPresent ()) {
87
89
throw new ConfigurationException ("oidc-proxy.external-redirect-uri property must be configured because"
@@ -91,7 +93,7 @@ public void setup(Router router, String httpRootPath) {
91
93
}
92
94
93
95
if (oidcMetadata .getEndSessionUri () != null ) {
94
- router .get (httpRootPath + oidcProxyConfig .rootPath () + oidcProxyConfig .endSessionPath ()).handler (this ::endSession );
96
+ router .get (oidcProxyConfig .rootPath () + oidcProxyConfig .endSessionPath ()).handler (this ::endSession );
95
97
if (oidcTenantConfig .logout ().postLogoutPath ().isPresent ()) {
96
98
if (!oidcProxyConfig .externalPostLogoutUri ().isPresent ()) {
97
99
throw new ConfigurationException ("oidc-proxy.external-post-logout-uri property must be configured because"
@@ -511,6 +513,7 @@ private String buildUri(RoutingContext context, String path) {
511
513
: context .request ().scheme ();
512
514
return new StringBuilder (scheme ).append ("://" )
513
515
.append (authority )
516
+ .append (httpRootPath )
514
517
.append (path )
515
518
.toString ();
516
519
}
0 commit comments