Skip to content

Commit

Permalink
Use system properties instead of env
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed Jul 22, 2022
1 parent 7918abb commit 61151d4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ public void onMessage(Session session, String message, @PathParam("executionId")
Boolean isSSL = (Boolean) session.getUserProperties().get("isSSL");
String serverHost = (String) session.getUserProperties().get("Host");

boolean ssoEnabled = Optional.ofNullable(System.getenv("SSO_ENABLED"))
.orElse("false")
.equals("true");
if (ssoEnabled) {
String keycloakEnabled = System.getProperty("windup.sso.enabled", "false");
if (keycloakEnabled.equals("true")) {
authenticate(isSSL, serverHost, session, message);
}

Expand Down
12 changes: 4 additions & 8 deletions services/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
<security-constraint>
<web-resource-collection>
<web-resource-name>secured</web-resource-name>
<url-pattern>/*</url-pattern>
<url-pattern>${windup.secured.url}</url-pattern>
</web-resource-collection>
<!-- <auth-constraint>-->
<!-- <role-name>user</role-name>-->
<!-- </auth-constraint>-->
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>

<security-constraint>
Expand Down Expand Up @@ -61,10 +61,6 @@
</web-resource-collection>
</security-constraint>

<!-- <login-config>-->
<!-- <auth-method>KEYCLOAK</auth-method>-->
<!-- </login-config>-->

<security-role>
<role-name>user</role-name>
</security-role>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,12 @@ public Object exec(List arguments) throws TemplateModelException
}
});

boolean ssoEnabled = Optional.ofNullable(System.getenv("SSO_ENABLED"))
.orElse("false")
.equals("true");

hashModel.put("ssoEnabled", String.valueOf(ssoEnabled));
String keycloakEnabled = System.getProperty("windup.sso.enabled", "false");
hashModel.put("ssoEnabled", keycloakEnabled);

Map<String, String> keycloakProperties = new HashMap<>();
keycloakProperties.put(PUBLIC_KEY, ssoEnabled ? System.getProperty("keycloak.realm.public.key") : "***");
keycloakProperties.put(SERVER_URL, ssoEnabled ? System.getProperty("keycloak.server.url") : "***");
keycloakProperties.put(PUBLIC_KEY, System.getProperty("keycloak.realm.public.key", "***"));
keycloakProperties.put(SERVER_URL, System.getProperty("keycloak.server.url", "***"));

hashModel.put(KEYCLOAK, keycloakProperties);

Expand Down
10 changes: 3 additions & 7 deletions ui-pf4/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,11 @@
<url-pattern>/authenticated.jsp</url-pattern>
<url-pattern>/app/*</url-pattern>
</web-resource-collection>
<!-- <auth-constraint>-->
<!-- <role-name>user</role-name>-->
<!-- </auth-constraint>-->
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>

<!-- <login-config>-->
<!-- <auth-method>KEYCLOAK</auth-method>-->
<!-- </login-config>-->

<security-role>
<role-name>user</role-name>
</security-role>
Expand Down

0 comments on commit 61151d4

Please sign in to comment.