shiro小记

阅读 63

2021-09-29

shiro介绍

Shiro是一个Java平台的开源权限框架,用于认证和访问授权

shiro用户验证流程


流程1:主要初始化一些关于shiro需要用到的相关对象;例如:初始化SecurityManager工厂

流程2:suject.login(token)验证用户名密码;token中带有用户名和密码信息

流程3:调用SecurityManager.login(token)

流程4:AuthenticatingRealm.getAuthenticationInfo(AuthenticationToken token)为主要的验证用户方法;AuthenticatingRealm属于抽象类,通过getAuthenticationInfo(AuthenticationToken token)方法已经封装好了验证用户信息的流程,但是暴露出一个抽象方法,即:AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token);让自定义的reamls根据自己的逻辑去获取AuthenticationInfo对象

流程5:就是流程4里面验证的具体主要信息

subject.login(token)里面的具体细节

shiro里面一些主要的接口以及实现

接口:

接口实现:

关联的一些重要接口:

shiro权限验证流程


流程2:获取一些拦截器;其中包括:

1)RoleAnnotationMethodInterceptor;

2)PermissionAnnotationMethodInterceptor;

3)AuthenticatedAnnotationMethodInterceptor;

4)UserAnnotationMethodInterceptor;

5)GuestAnnotationMethodInterceptor;

以上就是shiro大体的用户验证与授权流程;具体细节还得看源码~

精彩评论(0)

0 0 举报