抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

Shiro主要组件包括:Subject,SecurityManager,Authenticator,Authorizer,SessionManager,CacheManager,Cryptography,Realms。 SubjectSubject表示与系统交互的对象,可以是登录系统的操作用户,也可能是另外一个软件系统。Subject类图: SecurityManagerSecurity...

1234567891011121314Subject currentUser = SecurityUtils.getSubject();UsernamePasswordToken token = new UsernamePasswordToken(username, password);token.setRememberMe(true);try {  currentUser.log...

在SimpleAuthenticationInfo构造函数中,第一个参数是principal,第二个参数是credencials,第三个参数可选,是用于哈希的盐的值,第四个是realm名字。 doGetAuthenticationInfo(AuthenticationToken token)得到AuthticationInfo之后,会自定对比里面的credencitals和subject.l...

principal 指的是账号这样的令牌 credentials 指的是密码这样的密钥

123456789101112131415161718192021@Bean(name = "shiroFilter")public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) { ShiroFilterFactoryBean shiroFilterFactoryB...

在使用jwt认证过程中,后端不用记录httpSession,也就可以禁用session,shiro有自带的session,同样也可以禁用。 12345678@Beanprotected ShiroFilterChainDefinition shiroFilterChainDefinition() { DefaultShiroFilterChainDefinition chai...

AuthenticationInfo对象中存储的是主体(Subject)的身份认证信息。Shiro会调用CredentialsMatcher对象的doCredentialsMatch方法对AuthenticationInfo对象和AuthenticationToken进行匹配。匹配成功则表示主体(Subject)认证成功,否则表示认证失败。 123456789101112131415161...

shiro有个AbstractAuthenticator类,作为验证器的基类。它有一个方法作为鉴权方法 12protected abstract AuthenticationInfo doAuthenticate(AuthenticationToken token) throws AuthenticationException; ModularRealmAuthenticator继承Abs...

系统架构 在shiro架构中,有3个最主要的组件:Subject,SecurityManager,Realm。 Subject本质上就是当前访问用户的抽象描述。 SecurityManager是Shiro架构中最核心的组件,通过它可以协调其他组件完成用户认证和授权。实际上,SecurityManager就是Shiro框架的控制器。 Realm定义了访问数据的方式,用来连接不同的数据源,如:L...

shiro可以在独立的环境中使用,也可以集成在spring中。但是与springBoot的rest风格接口整合却会发现非常的困难。有很多不合适的地方。 这是和spring整合时使用的,支持权限校验错误指定重定向到指定url 12345<dependency> <groupId>org.apache.shiro</groupId> <art...