2016-08-04 22:47:31 +08:00
|
|
|
package com.svlada.security.service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
|
|
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import com.svlada.security.model.UserContext;
|
|
|
|
|
import com.svlada.security.model.UserRole;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mock implementation.
|
|
|
|
|
*
|
|
|
|
|
* @author vladimir.stankovic
|
|
|
|
|
*
|
|
|
|
|
* Aug 4, 2016
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class UserService {
|
|
|
|
|
public UserContext loadUser(String username, String password) {
|
|
|
|
|
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
|
|
|
|
|
authorities.add(new SimpleGrantedAuthority(UserRole.ADMIN.authority()));
|
2016-08-05 22:51:59 +08:00
|
|
|
return new UserContext(username, authorities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UserContext loadUser(String username) {
|
|
|
|
|
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
|
|
|
|
|
authorities.add(new SimpleGrantedAuthority(UserRole.ADMIN.authority()));
|
|
|
|
|
return new UserContext(username, authorities);
|
2016-08-04 22:47:31 +08:00
|
|
|
}
|
|
|
|
|
}
|