简单继承UserDetailsService
来源:互联网 发布:不用软件 鼠标控制 编辑:程序博客网 时间:2024/06/05 15:07
public class UserService implements UserDetailsService {
public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException, DataAccessException {
// TODO Auto-generated method stub
GrantedAuthorityImpl grant = new GrantedAuthorityImpl("ROLE_SUPERVISOR");
GrantedAuthority[] arrayAuths = {grant};
//这里的后果就是无论什么用户名只要是这个密码就认可他
//并且给他ROLE_SUPERVISOR的权限
return new User(arg0, "koala", true,
true, true, true, arrayAuths);
}
}
UserDetailsService的功能,依照现在的理解UserDetailsService返回一个UserDetails用于验证用户名和密码
按照docbook上的说法
Remember the advantage that whatever your UserDetailsService returns can always be obtained from the
那是否应该理解为SecurityContext.getAuthentication().getPrincipal()得到的就是由UserDetailsService返回的?
go on....
public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException, DataAccessException {
// TODO Auto-generated method stub
GrantedAuthorityImpl grant = new GrantedAuthorityImpl("ROLE_SUPERVISOR");
GrantedAuthority[] arrayAuths = {grant};
//这里的后果就是无论什么用户名只要是这个密码就认可他
//并且给他ROLE_SUPERVISOR的权限
return new User(arg0, "koala", true,
true, true, true, arrayAuths);
}
}
UserDetailsService的功能,依照现在的理解UserDetailsService返回一个UserDetails用于验证用户名和密码
按照docbook上的说法
Remember the advantage that whatever your UserDetailsService returns can always be obtained from the
SecurityContextHolder
, as per the above code fragment.那是否应该理解为SecurityContext.getAuthentication().getPrincipal()得到的就是由UserDetailsService返回的?
go on....
- 简单继承UserDetailsService
- Spring security +Hibernate+UserDetailsService认证
- 简单继承
- acegi security实践教程—定制userDetailsService
- Spring Security身份认证之UserDetailsService
- 简单多继承
- 简单继承UserDetails
- 简单继承AuthenticationProvider
- 简单的继承题
- 封装,简单继承
- 继承简单示例
- java 简单类继承
- Flex4 继承简单实现
- 简单的继承模版
- 继承的简单实现
- 【java】简单继承练习
- 继承的简单理解
- 继承的简单用法
- ecos内存管理
- resin分析
- Spring声明式事务解释
- Windows图形基础(一)
- 避免在 SOA 采用过程中遇到的常见失误
- 简单继承UserDetailsService
- 将Java程序作成exe文件的N种方法
- 利用Myeclipse快速开发struts应用程序
- 枚举和递归
- KMP算法以及简单应用(查找单词)
- 读取配置文件的方法案例
- Java基本数据类型转换 [转]
- 关联容器(Associative Container)
- 利用Hibernate编写通用的数据库操作代码