aboutsummaryrefslogtreecommitdiff
path: root/juick-spring-www/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-28 13:39:04 +0700
committerGravatar Alexander Alexeev2016-11-28 13:39:04 +0700
commitbc23d2d2125d2086847397e85335f29a70668f6b (patch)
tree8c4f0ce7a91763eec65ce36559b7a6c388d9c68d /juick-spring-www/src/main/java/com/juick
parent47a285e60b0780c7d81e4e1b77736f69e0aaf761 (diff)
remember-me authorization with test; a statndard DaoAuthentication provider used
Diffstat (limited to 'juick-spring-www/src/main/java/com/juick')
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java16
1 files changed, 2 insertions, 14 deletions
diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
index 3753a4aa..95a94642 100644
--- a/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
+++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
@@ -1,8 +1,7 @@
package com.juick.www.configuration;
import com.juick.service.UserService;
-import com.juick.server.security.entities.JuickUser;
-import org.apache.commons.lang3.StringUtils;
+import com.juick.service.security.JuickUserDetailsService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
@@ -10,7 +9,6 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
import javax.annotation.Resource;
@@ -32,17 +30,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Bean("userDetailsService")
@Override
public UserDetailsService userDetailsServiceBean() throws Exception {
- return username -> {
- if (StringUtils.isBlank(username))
- throw new UsernameNotFoundException("Invalid user name " + username);
-
- com.juick.User user = userService.getUserByName(username);
-
- if (user != null)
- return new JuickUser(user);
-
- throw new UsernameNotFoundException("The username " + username + " is not found");
- };
+ return new JuickUserDetailsService(userService);
}
@Override