forked from indigo-iam/iam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cors configuration & actuator test fixes
- Loading branch information
1 parent
4ed75ff
commit 4a70982
Showing
12 changed files
with
114 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,4 +267,5 @@ ServletRegistrationBean h2Console() { | |
VelocityEngine velocityEngine() { | ||
return new VelocityEngine(); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
iam-login-service/src/main/java/it/infn/mw/iam/config/security/CorsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package it.infn.mw.iam.config.security; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
import org.springframework.web.filter.CorsFilter; | ||
|
||
@Configuration | ||
public class CorsConfig { | ||
|
||
private static final String[] CORS_ENDPOINT_MATCHERS = | ||
// @formatter:off | ||
{ | ||
"/api/**", | ||
"/resource/**", | ||
"/register/**", | ||
"/iam/**", | ||
"/scim/**", | ||
"/token", | ||
"/introspect", | ||
"/userinfo", | ||
"/revoke/**", | ||
"/jwk", | ||
"/devicode" | ||
}; | ||
//@formatter:on | ||
|
||
@Bean | ||
CorsFilter corsFilter() { | ||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
CorsConfiguration corsConfig = new CorsConfiguration(); | ||
corsConfig.applyPermitDefaultValues(); | ||
|
||
for (String m : CORS_ENDPOINT_MATCHERS) { | ||
source.registerCorsConfiguration(m, corsConfig); | ||
} | ||
|
||
return new CorsFilter(source); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.