Tag: shiro

persistence.xml从.properties文件导入数据库参数值

编辑: 不重复,但差不多 我想让我的应用程序persistence.xml成为类似的东西 org.hibernate.ejb.HibernatePersistence 从我的源文件夹中的某个简单文本文件中获取这些占位符值。 我读到了使用Spring做的可能性 classpath:com/foo/jdbc.properties 但是在这里我们不使用Spring,只使用Hibernate和一些Primefaces。 可能吗? 谢谢! 编辑:我没有提到一些东西,但作为参考,我也使用Shiro Security和Ant来做一些事情。 我会发布解决方案作为答案。 这使我的项目有3个不同的文件与数据库参数: persistence.xml(Hibernate) context.xml(Shiro) database.properties(用于Ant中的Flyway任务)

使用JavaConfig和Spring Boot的Apache Shiro JdbcRealm

我正在尝试配置我的Spring Boot应用程序以使用Apache Shiro作为其安全框架。 我有一切使用PropertiesRealm,现在我正在尝试使用JdbcRealm和Spring Boot的内置H2数据库。 这是我在pom.xml中的依赖项: org.apache.shiro shiro-core 1.2.3 org.apache.shiro shiro-spring 1.2.3 org.apache.shiro shiro-web 1.2.3 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-jdbc com.h2database h2 我的schema.sql: create table if not exists users ( username varchar(256), password varchar(256), enabled boolean ); create table if not exists user_roles ( username varchar(256), role_name varchar(256) ); 我的data.sql: insert into users (username, […]

无法在自定义Apache Shiro AuthorizingRealm中@Inject我的DAO

我正在尝试将我的UserDAO注入Apache Shiro正在使用的自定义AuthorizingRealm中,但是……我得到了null。 我究竟做错了什么? shiro.ini [main] user = demo.shiro.security.FacesAjaxAwareUserFilter realmA = demo.shiro.security.JpaRealm credentialsMatcher = org.apache.shiro.authc.credential.SimpleCredentialsMatcher realmA.credentialsMatcher = $credentialsMatcher securityManager.realms = $realmA user.loginUrl = /pages/public/login.xhtml [users] admin = admin user = user [urls] # public files and folders /index.html = anon /resources/** = anon /pages/public/** = anon # restricted files and folders /pages/admin/** = user /pages/user/** = […]

NoSuchMethodError:org.slf4j.impl.StaticLoggerBinder.getSingleton()

这个问题是由我的pom.xml [cxf-bundle-jaxrs]中的一个依赖项引起的,它在内部使用较低版本的slf4j。 我设法通过将此依赖项升级到最新版本来解决此问题。 感谢大家。 我正在尝试将Apache Shiro添加到我的CXF Spring Web应用程序中。 当我启动我的tomcat 7时,我收到以下错误 Caused by: java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder; at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254) at org.apache.shiro.spring.LifecycleBeanPostProcessor.(LifecycleBeanPostProcessor.java:51) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) … 25 more 我的shiro和slf4j的pom.xml是 org.apache.shiro shiro-core 1.2.2 org.apache.shiro shiro-web 1.2.2 org.apache.shiro shiro-spring 1.2.2 org.slf4j […]

如何在Grails或Java Application中轻松实现“谁在线”?

我正在建立一个grails的社区网站(使用Apache Shiro进行安全和身份validation系统),我想实现“谁在线?”这一function。 这个urlhttp://cksource.com/forums/viewonline.php (如果您没有访问此url,请参阅下面的快照)给出了我想要实现的示例。 我怎么能以最简单的方式做到这一点? Grails或Java中是否存在任何现有解决方案? 谢谢。 快照: Who的快照在线页面http://sofzh.miximages.com/java/www.freeimagehosting.net或在此处查看: http : //www.freeimagehosting.net/image.php?2de8468a86.png

何时从Container托管安全迁移到Apache Shiro,Spring Security等替代方案?

我正在尝试保护使用JSF2.0构建的应用程序。 我很困惑人们什么时候选择使用像Shiro,Spring Security或者owasp的esapi这样的安全替代品来留下容器管理的安全性。 看过Stack Overflow上的一些相关问题后 ,我意识到JSF开发人员过去更喜欢基于容器的安全性。 但我也强烈建议使用Apache Shiro。 我是安全问题的新手,不知道可能是什么相关问题以及如何处理它们。 因此,我正在寻找通过其默认设置/自己处理大多数安全问题的东西。 就我的应用程序需求而言,我有一个社交应用程序,具有不同角色的用户可以访问不同的页面集,并可以根据他们的角色在这些页面上使用不同级别的function。 在那种情况下,你觉得什么对我来说是个不错的选择? 我个人已经确信选择Shiro因为它易于使用并且为新手照顾大部分事情。