diff options
author | Alexander Alexeev | 2016-12-01 00:34:25 +0700 |
---|---|---|
committer | Alexander Alexeev | 2016-12-01 00:34:25 +0700 |
commit | 92d6700919e87c81db4a42a4b286257f62566cbf (patch) | |
tree | e1ff4baee90c20194593e6886c6769f442890d19 /juick-api/src/main/java/com/juick/api | |
parent | 92f638429647d328d8a6b6168755b148ec237d3a (diff) |
remember-me for juick-api by request parameter
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java b/juick-api/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java index 9f937c98..99731d2a 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java @@ -3,7 +3,8 @@ package com.juick.api.configuration; import com.juick.server.security.JuickAuthenticationEntryPoint; import com.juick.service.UserService; import com.juick.service.security.JuickUserDetailsService; -import com.juick.service.security.SimpleRememberMeServices; +import com.juick.service.security.deprecated.CookieSimpleHashRememberMeServices; +import com.juick.service.security.deprecated.RequestParamHashRememberMeServices; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @@ -21,6 +22,7 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import javax.inject.Inject; import java.util.Arrays; +import java.util.Collections; import java.util.concurrent.TimeUnit; /** @@ -77,7 +79,7 @@ public class ApiSecurityConfig extends WebSecurityConfigurerAdapter { @Bean public RememberMeServices rememberMeServices() throws Exception { - return new SimpleRememberMeServices(env.getProperty("auth_remember_me_key"), userService, env); + return new RequestParamHashRememberMeServices(env.getProperty("auth_remember_me_key"), userService); } @Bean @@ -89,9 +91,9 @@ public class ApiSecurityConfig extends WebSecurityConfigurerAdapter { public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(Arrays.asList("*")); + configuration.setAllowedOrigins(Collections.singletonList("*")); configuration.setAllowedMethods(Arrays.asList("POST", "GET", "PUT", "OPTIONS", "DELETE")); - configuration.setAllowedHeaders(Arrays.asList("*")); + configuration.setAllowedHeaders(Collections.singletonList("*")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); |