File tree Expand file tree Collapse file tree
src/main/java/eu/openanalytics/containerproxy/auth/impl/oidc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ public class OpenIDConfiguration {
5555 public static final String PROP_OPENID_JWKS_SIGNATURE_ALGORITHM = "proxy.openid.jwks-signature-algorithm" ;
5656 public static final String PROP_DEFAULT_ALGORITHM = "RS256" ;
5757 public static final String PROP_INCLUDE_DEFAULT_SCOPES = "proxy.openid.include-default-scopes" ;
58+ public static final String PROP_ENFORCE_HTTPS_REDIRECT_URI = "proxy.openid.enforce-https-redirect-uri" ;
5859
5960 @ Inject
6061 private Environment environment ;
@@ -82,7 +83,7 @@ public ClientRegistrationRepository clientRegistrationRepository() {
8283 .withRegistrationId (REG_ID )
8384 .authorizationGrantType (AuthorizationGrantType .AUTHORIZATION_CODE )
8485 .clientName (REG_ID )
85- .redirectUri ("{baseUrl}/login/oauth2/code/{registrationId}" )
86+ .redirectUri (getOpenIdRedirectUri () )
8687 .scope (scopes .toArray (new String [0 ]))
8788 .userNameAttributeName (environment .getProperty ("proxy.openid.username-attribute" , "email" ))
8889 .authorizationUri (environment .getProperty ("proxy.openid.auth-url" ))
@@ -120,4 +121,11 @@ public JwtDecoderFactory<ClientRegistration> oidcIdTokenDecoderFactory() {
120121 return factory ;
121122 }
122123
124+ private String getOpenIdRedirectUri () {
125+ if (environment .getProperty (PROP_ENFORCE_HTTPS_REDIRECT_URI , Boolean .class , false )) {
126+ return "https://{baseHost}{basePort}{basePath}/login/oauth2/code/{registrationId}" ;
127+ }
128+ return "{baseUrl}/login/oauth2/code/{registrationId}" ;
129+ }
130+
123131}
You can’t perform that action at this time.
0 commit comments