当前位置: 首页 > wzjs >正文

优秀的字体设计网站室内设计公司排名及案例

优秀的字体设计网站,室内设计公司排名及案例,sem是什么?,国内做的好的网站1. 用户名和密码被过滤器获取到,封装成 Authentication ,通常情况下是 UsernamePasswordAuthenticationToken 这个实现类。 2. AuthenticationManager 身份管理器负责验证这个 Authentication 3. 认证成功后, AuthenticationManager 身份管理器返回一…

1. 用户名和密码被过滤器获取到,封装成 Authentication ,通常情况下是 UsernamePasswordAuthenticationToken 这个实现类。

2. AuthenticationManager 身份管理器负责验证这个 Authentication

3. 认证成功后, AuthenticationManager 身份管理器返回一个被填充满了信息的(包括上面提到的 权限信息,身份信息,细节信息,但密码通常会被移除) Authentication 实例。

4. SecurityContextHolder 安全上下文容器将第3步填充了信息的 Authentication ,通过 SecurityContextHolder.getContext().setAuthentication(…)方法,设置到其中。

public class AuthenticationExample {
private static AuthenticationManager am = new SampleAuthenticationManager();
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
测试
while (true) {
System.out.println("Please enter your username:");
String name = in.readLine();
System.out.println("Please enter your password:");
String password = in.readLine();
try {
// 封装认证信息,未认证通过
Authentication request = new
UsernamePasswordAuthenticationToken(name, password);
// 认证逻辑
Authentication result = am.authenticate(request);
//当前线程绑定认证信息
SecurityContextHolder.getContext().setAuthentication(result);
break;
} catch (AuthenticationException e) {
System.out.println("Authentication failed: " + e.getMessage());
}
}
System.out.println("Successfully authenticated. Security context
contains: " +
SecurityContextHolder.getContext().getAuthentication());
}
}
class SampleAuthenticationManager implements AuthenticationManager {
static final List<GrantedAuthority> AUTHORITIES = new
ArrayList<GrantedAuthority>();
static {
AUTHORITIES.add(new SimpleGrantedAuthority("ROLE_USER"));
}
@Override
public Authentication authenticate(Authentication auth) throws
AuthenticationException {
// 判断条件,用户名和密码是否相同
if (auth.getName().equals(auth.getCredentials())) {
// 封装认证信息,认证已通过
return new UsernamePasswordAuthenticationToken(auth.getName(),
auth.getCredentials(), AUTHORITIES);
}
throw new BadCredentialsException("Bad Credentials");
}
}
认证流程

推荐阅读

技术总体方案设计思路

如何评价代码的质量-CSDN博客

领域分解识别服务

http://www.dtcms.com/wzjs/837857.html

相关文章:

  • 做本地网站怎么挣钱本科自考报名的时间
  • 厦门微信网站建设学做网站需要什么
  • 重庆江北营销型网站建设公司推荐电商实训网站建设报告
  • 网页特效代码免费网站怎么关闭seo综合查询
  • 品牌网站建设h5pc端网站建设相关查阅资料
  • wordpress wiki 整合百度seo关键词排名查询工具
  • 芷江建设局的工作人员网站企业网站首页设计欣赏
  • 专业网站建设包括哪些购买软件平台
  • 免费建站平台排行榜电商erp
  • 电商类网站怎么做 seo微信端网站页面设计
  • 国外做建材的网站有哪些烟台展厅设计公司
  • 网站在线答题怎么做太平洋电脑配置报价官网
  • 那样的网站广州南沙区建设和交通局网站
  • 哪个网站可以免费做H5电商网站建设哪个好
  • 如何做网站站长精美企业网站
  • 寺庙招人做网站维护吗公众号排名优化
  • 钓鱼网站如何做上海国际物流网站建设
  • 高端网站建设需要的人员配备上海外贸网
  • 公司网站建设东莞怎样做网站宣传
  • 网站站外优化推广方式纹身网站建设
  • 公司手机网站建设价格个人主页签名引导进入橱窗
  • 网站建设分析书引言最近热点新闻大事件
  • 大埔县住房和城乡规划建设局网站建筑 企业官网设计
  • php网站开发实训指导书国外手表网站
  • 让网站排名下降去西安需要隔离吗
  • 微信营销网站建设程序外包网站
  • 403网站打开免费企业网站怎么搜索优化
  • 快速搭建网站 数据存储网站开发需求问卷
  • 网站制作资讯wordpress apply filters
  • 上海网站设计图片wordpress主题图片消失