diff --git a/README.md b/README.md index f816871..5434be4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Authorization Library -Authorization library is a library that provides a Spring Security (4.x.x) process +Authorization library is a library that provides a Spring Security (6.x.x) process in order to authorize the endpoints of a service base on OpenAIRE Authorities. It can be used with two different session strategies, a stateless and a Redis http session. @@ -19,7 +19,7 @@ user's session, but with a cost of an extra http request per request. eu.dnetlib uoa-authorization-library - 2.1.2 + 3.0.0 #### Spring Application/Configuration @@ -38,6 +38,7 @@ user's session, but with a cost of an extra http request per request. authorization.security.userInfoUrl = http:///login-service/userInfo # Required, default "" authorization.security.session= # Default openAIRESession + authorization.security.domain= # e.g openaire.eu Default: di.uoa.gr ## Redis @@ -53,7 +54,7 @@ where session is stored. eu.dnetlib uoa-authorization-library - 2.1.2 + 3.0.0 redis @@ -74,7 +75,7 @@ where session is stored. authorization.secuirty.redis.host= # Default localhost authorization.secuirty.redis.port= # Default 6379 authorization.secuirty.redis.password= # Default "" - authorization.security.domain= # e.g openaire.eu + authorization.security.domain= # e.g openaire.eu Default: di.uoa.gr authorization.security.session= # Default openAIRESession @@ -118,35 +119,3 @@ e.g + ")") @RequestMapping(value = "{type}/{id}", method = RequestMethod.GET) public Entity getEntity(@PathVariable("type") String type, @PathVariable("id") String id) {} - -## Spring Security (5.x.x) - Spring boot (2.x.x) - -Because of MitreID dependency, in order to use this library -with redis HttpSession, service has to use spring security (4.x.x). -The only way to use this library in a project with spring security 5.x.x -is the Stateless strategy with the following modification in Application -class: - - import eu.dnetlib.uoaauthorizationlibrary.configuration.AuthorizationConfiguration; - - @PropertySources({@PropertySource("classpath:authorization.properties")}) - @Import(AuthorizationConfiguration.class) - public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS") - .allowedOriginPatterns("*") - .allowCredentials(true); - } - }; - } - } \ No newline at end of file diff --git a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/controllers/AuthorizationLibraryCheckDeployController.java b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/controllers/AuthorizationLibraryCheckDeployController.java index 41d5782..0af5241 100644 --- a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/controllers/AuthorizationLibraryCheckDeployController.java +++ b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/controllers/AuthorizationLibraryCheckDeployController.java @@ -6,7 +6,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; diff --git a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/AuthorizationFilter.java b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/AuthorizationFilter.java index a7cf777..74ce529 100644 --- a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/AuthorizationFilter.java +++ b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/AuthorizationFilter.java @@ -18,7 +18,6 @@ public class AuthorizationFilter implements Filter { this.authorizationProvider = authorizationProvider; } - @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest req) { diff --git a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/WebSecurityConfig.java b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/WebSecurityConfig.java index 8484741..039e192 100644 --- a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/WebSecurityConfig.java +++ b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/stateless/security/WebSecurityConfig.java @@ -24,7 +24,6 @@ public class WebSecurityConfig { this.filter = filter; } - @Bean public EntryPoint entryPoint() { return new EntryPoint();