From 858edeaf8da1f8cb35179cce1ba0d1e5226fb269 Mon Sep 17 00:00:00 2001 From: Anton Liauchuk Date: Sun, 7 Jun 2020 15:28:05 +0300 Subject: [PATCH] security classes to security config module --- .../platform}/security/JwtTokenValidationException.java | 2 +- .../platform}/security/SecurityConfiguration.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) rename {users/application/src/main/java/com/educational/platform/users => security/config/src/main/java/com/educational/platform}/security/JwtTokenValidationException.java (81%) rename {users/application/src/main/java/com/educational/platform/users => security/config/src/main/java/com/educational/platform}/security/SecurityConfiguration.java (54%) diff --git a/users/application/src/main/java/com/educational/platform/users/security/JwtTokenValidationException.java b/security/config/src/main/java/com/educational/platform/security/JwtTokenValidationException.java similarity index 81% rename from users/application/src/main/java/com/educational/platform/users/security/JwtTokenValidationException.java rename to security/config/src/main/java/com/educational/platform/security/JwtTokenValidationException.java index 1c0d1bd..f5c3599 100644 --- a/users/application/src/main/java/com/educational/platform/users/security/JwtTokenValidationException.java +++ b/security/config/src/main/java/com/educational/platform/security/JwtTokenValidationException.java @@ -1,4 +1,4 @@ -package com.educational.platform.users.security; +package com.educational.platform.security; /** * Represents jwt token validation exception diff --git a/users/application/src/main/java/com/educational/platform/users/security/SecurityConfiguration.java b/security/config/src/main/java/com/educational/platform/security/SecurityConfiguration.java similarity index 54% rename from users/application/src/main/java/com/educational/platform/users/security/SecurityConfiguration.java rename to security/config/src/main/java/com/educational/platform/security/SecurityConfiguration.java index d4877a5..8a037cb 100644 --- a/users/application/src/main/java/com/educational/platform/users/security/SecurityConfiguration.java +++ b/security/config/src/main/java/com/educational/platform/security/SecurityConfiguration.java @@ -1,7 +1,9 @@ -package com.educational.platform.users.security; +package com.educational.platform.security; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @@ -9,6 +11,10 @@ * Represents security settings. */ @Configuration +@EnableGlobalMethodSecurity(prePostEnabled = true) +@ConditionalOnProperty( + name = "com.educational.platform.security.enabled", + havingValue = "true") public class SecurityConfiguration { @Bean