aboutsummaryrefslogtreecommitdiff
path: root/juick-spring-www/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-25 13:20:15 +0300
committerGravatar Vitaly Takmazov2016-11-25 13:20:15 +0300
commit55b09a6a3bc4a21201189d855e140308f05016fb (patch)
tree543c880aaf15bf396eca6255bd816fb7d5dc9f12 /juick-spring-www/src/main/java/com/juick
parentefe9b6d78c9aac2b92afe2d55d2f33e4b5e6d179 (diff)
juick-api: security WIP
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.java2
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/entity/JuickUser.java62
2 files changed, 1 insertions, 63 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 dcbd5459..3753a4aa 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,7 +1,7 @@
package com.juick.www.configuration;
import com.juick.service.UserService;
-import com.juick.www.entity.JuickUser;
+import com.juick.server.security.entities.JuickUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
diff --git a/juick-spring-www/src/main/java/com/juick/www/entity/JuickUser.java b/juick-spring-www/src/main/java/com/juick/www/entity/JuickUser.java
deleted file mode 100644
index 20d7889d..00000000
--- a/juick-spring-www/src/main/java/com/juick/www/entity/JuickUser.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.juick.www.entity;
-
-import com.juick.User;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * Created by aalexeev on 11/21/16.
- */
-public class JuickUser implements UserDetails {
- private static final GrantedAuthority ROLE_USER = new SimpleGrantedAuthority("ROLE_USER");
-
- private final com.juick.User user;
-
-
- public JuickUser(com.juick.User user) {
- this.user = user;
- }
-
- @Override
- public Collection<? extends GrantedAuthority> getAuthorities() {
- return Collections.singletonList(ROLE_USER);
- }
-
- @Override
- public String getPassword() {
- return null;
- }
-
- @Override
- public String getUsername() {
- return user.getName();
- }
-
- @Override
- public boolean isAccountNonExpired() {
- return true;
- }
-
- @Override
- public boolean isAccountNonLocked() {
- return false;
- }
-
- @Override
- public boolean isCredentialsNonExpired() {
- return true;
- }
-
- @Override
- public boolean isEnabled() {
- return !user.isBanned();
- }
-
- public User getUser() {
- return user;
- }
-}