From 92d6700919e87c81db4a42a4b286257f62566cbf Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Thu, 1 Dec 2016 00:34:25 +0700 Subject: remember-me for juick-api by request parameter --- .../java/com/juick/api/configuration/ApiSecurityConfig.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'juick-api/src/main') 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); -- cgit v1.2.3