Skip to content

Commit bc4431b

Browse files
authored
hotfix oid4vci cors allowed origins (#102)
* hotfix oid4vci cors allowed origins * hotfix oid4vci cors allowed origins * hotfix oid4vci cors allowed origins * hotfix oid4vci cors allowed origins * hotfix oid4vci cors allowed origins * hotfix oid4vci cors allowed origins * remove log
1 parent 8dc7b66 commit bc4431b

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [v1.6.6](https://github.com/in2workspace/in2-issuer-api/releases/tag/v1.6.6)
8+
### Fixed
9+
- OID4VCI cors configuration.
10+
711
## [v1.6.5](https://github.com/in2workspace/in2-issuer-api/releases/tag/v1.6.5)
812
### Fixed
913
- Refactor configs.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212

1313
group = 'es.in2'
14-
version = '1.6.5'
14+
version = '1.6.6'
1515

1616
java {
1717
sourceCompatibility = '17'

src/main/java/es/in2/issuer/backend/backoffice/infrastructure/config/security/Oid4vciCORSConfig.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@
1515
@RequiredArgsConstructor
1616

1717
public class Oid4vciCORSConfig {
18-
private final AppConfig appConfig;
19-
2018
/**
2119
* Default CORS configuration source.
2220
*/
2321
@Bean
2422
public UrlBasedCorsConfigurationSource oid4vciCorsConfigurationSource() {
2523
CorsConfiguration configuration = new CorsConfiguration();
26-
configuration.setAllowedOrigins(appConfig.getDefaultCorsAllowedOrigins());
24+
configuration.setAllowedOriginPatterns(List.of("*"));
2725
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
2826
configuration.setAllowedHeaders(List.of("*"));
29-
configuration.setAllowCredentials(true);
27+
configuration.setAllowCredentials(false);
3028
configuration.setMaxAge(1800L);
3129

3230
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
3331
source.registerCorsConfiguration(OID4VCI_CREDENTIAL_OFFER_PATH, configuration);
3432
source.registerCorsConfiguration(OAUTH_TOKEN_PATH, configuration);
33+
source.registerCorsConfiguration(OID4VCI_CREDENTIAL_PATH, configuration);
3534
return source;
3635
}
3736
}

src/main/java/es/in2/issuer/backend/backoffice/infrastructure/config/security/SecurityConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public SecurityWebFilterChain externalFilterChain(ServerHttpSecurity http) {
129129
public SecurityWebFilterChain oid4vciFilterChain(ServerHttpSecurity http) {
130130
http
131131
.securityMatcher(ServerWebExchangeMatchers.pathMatchers(CORS_OID4VCI_PATH))
132-
.cors(cors -> oid4VciCORSConfig.oid4vciCorsConfigurationSource())
132+
.cors(cors -> cors.configurationSource(oid4VciCORSConfig.oid4vciCorsConfigurationSource()))
133133
.authorizeExchange(exchanges -> exchanges
134134
.pathMatchers(OAUTH_TOKEN_PATH, OID4VCI_CREDENTIAL_OFFER_PATH).permitAll()
135135
.anyExchange().authenticated()

0 commit comments

Comments
 (0)