Skip to content

Commit fc4881c

Browse files
committed
Test
1 parent e40b6e7 commit fc4881c

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

.gcp.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SENTRIUS_VERSION=1.0.15
1+
SENTRIUS_VERSION=1.0.16
22
SENTRIUS_SSH_VERSION=1.0.2
33
SENTRIUS_KEYCLOAK_VERSION=1.0.4
44
SENTRIUS_AGENT_VERSION=1.0.11

api/src/main/java/io/sentrius/sso/config/SecurityConfig.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.sentrius.sso.core.services.UserService;
1313
import lombok.RequiredArgsConstructor;
1414
import lombok.extern.slf4j.Slf4j;
15+
import org.springframework.beans.factory.annotation.Value;
1516
import org.springframework.context.annotation.Configuration;
1617
import org.springframework.security.config.Customizer;
1718
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -38,6 +39,9 @@ public class SecurityConfig {
3839
private final CustomAuthenticationSuccessHandler successHandler;
3940
final UserService userService;
4041

42+
@Value("${https.required:true}") // Default is true
43+
private boolean httpsRequired;
44+
4145

4246
@Bean
4347
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
@@ -54,6 +58,13 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
5458
)
5559
.cors(Customizer.withDefaults());
5660

61+
if (httpsRequired) {
62+
http.requiresChannel(channel -> channel
63+
.requestMatchers("/actuator/**").requiresInsecure() // Allow HTTP for Actuator
64+
.anyRequest().requiresSecure() // Force HTTPS for all other requests
65+
);
66+
}
67+
5768

5869
return http.build();
5970
}

api/src/main/resources/application.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ spring.security.oauth2.resourceserver.jwt.issuer-uri=http://192.168.1.162:8180/r
7575
spring.security.oauth2.client.provider.keycloak.issuer-uri=http://192.168.1.162:8180/realms/sentrius
7676

7777
management.endpoints.web.exposure.include=health
78-
management.endpoint.health.show-details=always
78+
management.endpoint.health.show-details=always
79+
https.required=false

sentrius-chart/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ sentrius:
6565
spring.security.oauth2.client.registration.keycloak.scope=openid,profile,email
6666
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://sentrius-keycloak:30081/realms/sentrius
6767
spring.security.oauth2.client.provider.keycloak.issuer-uri=http://sentrius-keycloak:30081/realms/sentrius
68+
https.required=false
6869
dynamic: |
6970
auditorClass=io.sentrius.sso.automation.auditing.AccessTokenAuditor
7071
twopartyapproval.option.LOCKING_SYSTEMS=true

sentrius-gcp-chart/templates/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ data:
108108
spring.security.oauth2.client.provider.keycloak.issuer-uri=https://keycloak.{{ .Values.tenant }}.sentrius.cloud/realms/sentrius
109109
server.forward-headers-strategy=native
110110
https.redirect.enabled=true
111+
https.required=true
111112
dynamic.properties: |
112113
auditorClass=io.sentrius.sso.automation.auditing.AccessTokenAuditor
113114
twopartyapproval.option.LOCKING_SYSTEMS=true

0 commit comments

Comments
 (0)