You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.4 KiB
71 lines
1.4 KiB
package org.ros.chatto.security;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
|
|
import org.ros.chatto.model.ChatUser;
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
|
public class MyUserPrincipal implements UserDetails {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = -2761445275537412028L;
|
|
private ChatUser user;
|
|
|
|
public MyUserPrincipal(ChatUser user) {
|
|
super();
|
|
this.user = user;
|
|
}
|
|
|
|
@Override
|
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
|
// TODO Auto-generated method stub
|
|
return Collections.singleton(new SimpleGrantedAuthority("USER"));
|
|
}
|
|
|
|
@Override
|
|
public String getPassword() {
|
|
// TODO Auto-generated method stub
|
|
return user.getPassword();
|
|
}
|
|
|
|
@Override
|
|
public String getUsername() {
|
|
// TODO Auto-generated method stub
|
|
return user.getUserName();
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonExpired() {
|
|
// TODO Auto-generated method stub
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonLocked() {
|
|
// TODO Auto-generated method stub
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCredentialsNonExpired() {
|
|
// TODO Auto-generated method stub
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isEnabled() {
|
|
// TODO Auto-generated method stub
|
|
return true;
|
|
}
|
|
|
|
public ChatUser getChatUser()
|
|
{
|
|
return user;
|
|
}
|
|
|
|
}
|