- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我安装了 Apache Shiro 1.4.0 并关注了 this official tutorial为了设置它。
当我尝试初始化时 SecurityUtils
与 SecurityManager
使用教程中的此代码:
Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini");
SecurityManager securityManager = factory.getInstance();
SecurityUtils.setSecurityManager(securityManager);
IniSecurityManagerFactory
现在不推荐使用 Shiro 的
Environment
.
Environment
初始化 Shiro 的教程,它的文档并没有多大帮助:
An Environment instance encapsulates all of the objects that Shiro requires to function. It is essentially a 'meta' object from which all Shiro components can be obtained for an application.
An Environment instance is usually created as a result of parsing a Shiro configuration file. The environment instance can be stored in any place the application deems necessary, and from it, can retrieve any of Shiro's components that might be necessary in implementing security behavior.
For example, the most obvious component accessible via an Environment instance is the application's securityManager.
最佳答案
从 Shiro 1.5 开始,现在有 BasicIniEnvironment
.它的 Javadoc建议创建 SecurityManager
像这样:
Environment env = new BasicIniEnvironment("classpath:shiro.ini");
SecurityManager securityManager = env.getSecurityManager();
SecurityUtils.setSecurityManager(securityManager);
EnvironmentLoaderListener
在
web.xml
文件:
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
shiro.ini
加载配置通过查看以下位置:
shiro.ini
在类路径上,添加 Shiro 将自行选择配置。
关于java - Apache Shiro 1.4.0 初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45265622/
我已经一遍又一遍地讨论如何让用户登录 Shiro,但似乎仍然缺少一个重要的部分:shiro 如何根据存储的用户名和密码验证给定的用户名和密码?我想到的最多的是 It is each Realm's r
Apache Shiro 文档暗示了一些用于捕获连续失败登录尝试(以及其他)的所需功能,但是,我找不到具体的文档。目前我可以执行 currentUser.login(token);使用无效密码无限次并
我想在下一个Web项目中使用Shiro,但是我不知道一种好的(如果不是最好的)策略来管理用户(shiro.ini中的[users])。 最好为每个注册成员创建Shiro用户吗? 还是创建一个Shiro
我有一个简单的网络项目。我想在这个项目中访问多个角色是一个 URL。 网址的 sihor.ini 部分 [urls] /login.xhtml = authc /logout = logout /ad
我正在使用 apache shiro。当我想知道用户是否有权限和角色时,我使用 SecutiryUtils.getSubject()。我想知道如何向主题添加更多信息,例如电子邮件、主键和我需要的任何其
1、Shiro认证过程 1、收集实体/凭据信息 复制代码 代码如下: //Example using most common scenario of usern
我正在尝试使用 Shiro 对 Tomcat 6 中运行的 servlet 进行身份验证。 我有以下 shiro.ini 文件: [main] ps = org.apache.shiro.authc.
Apache Shiro的配置主要分为四部分: 对象和属性的定义与配置 URL的过滤器配置 静态用户配置 静态角色配置 其中,由于用户、角色一般由后台进行操作的动态数据,因此Shiro配置一般仅包
我正在使用 Spring MVC、Tiles 和 Shiro。 这是我的未授权Url 属性的配置方式: 我的期望是,当 MyAuthorizingRealm发现无效凭据,Shiro 将重定向到 /un
我正在使用 Apache Shiro 开发基于 EJB 的网络服务来管理用户访问权限。我添加了 freshly released我的 Maven 项目的 Apache Shiro 1.5.0 版使用新
我正在将现有应用程序从Grails 2.4.4升级到Grails 3.2.8。我正在尝试从grails shiro插件迁移到grails spring-security-shiro插件。除了访问已登录
我正在将我的应用程序从grails 2.4.4迁移到grails 3.2.9。 我正在尝试迁移到 compile 'org.grails.plugins:spring-security-shiro:3
在我包含 shiro-core-1.2.2 和 shiro-web-1.2.2 之前,我的 Maven Web 项目工作正常但是当我在 pom.xml 中包含此依赖项之后,我在执行时收到错误mvn t
我将 Apache Shiro 与 Spring 一起使用,并且仅使用 Spring 的 Java 配置。 (没有 XML)。下面是我的配置类的一部分: @Configuration public c
我能够使用 shiro.ini 和 spring 运行 shiro,但我想使用 shiro 注释,所以我尝试在没有 ini 文件的情况下使用 shiro-spring。但这让我很难受错误: org.a
1. 权限管理 1.1 什么是权限管理? 权限管理实现对用户访问系统的控制,按照安全规则或者安全策略,可以控制用户只能访问自己被授权的资源 权限管理包括用户身份认证和授权两部分,简称认证授权 1.2
我们经常会有用到,当A 用户在北京登录 ,然后A用户在天津再登录 ,要踢出北京登录的状态。如果用户在北京重新登录,那么又要踢出天津的用户,这样反复。 这样保证了一个帐号只能同时一个人使用。那么下面
有没有办法在 Shiro 中实现多因素身份验证?有人可以给我一个关于如何实现这一点的提示吗? 更多细节: 基本思想是,用户需要像往常一样使用用户名和密码登录,但在实际验证之前,用户还需要输入他作为 S
ini 文件就像 [main] authc.loginUrl = /login.html authc.successUrl = /index.html authc.usernameParam = j_
我了解 spring jsf 和 hibernate。我已经整合了它们并创建了我自己的框架。现在我想使用 Apache Shiro 将 session 管理添加到我的框架中。但我对 Apache Sh
我是一名优秀的程序员,十分优秀!