jdbc spring security,apache commons dbcp [英] jdbc spring security, apache commons dbcp
问题描述
在Spring Security中,我定义了一个jdbc auth管理器:
In a Spring Security, I defined a jdbc auth manager:
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="securityDataSource"/>
</security:authentication-provider>
</security:authentication-manager>
<bean id="securityDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver"/>
<property name="url" value="jdbc:postgresql://127.0.0.1:5432/mydb"/>
... user and password props ...
</bean>
此时我发现我需要Jakarta Commons DBCP。
我添加了commons-dbcp-1.4,我得到以下异常:
At this point I've discovered that I need Jakarta Commons DBCP. I've added commons-dbcp-1.4, i get the following exception:
...java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory
此路径实际上不包含在公共区域中dbcp 1.4。
我又错过了什么?
This path actually isn't included in commons dbcp 1.4.
What am I missing again?
编辑
好的,将依赖项添加到公共池,它的工作原理是因为有了正确的凭据我不再得到糟糕的证书页面。
但我收到HTTP状态403 - 访问被拒绝。
好像我的用户已经过身份验证,但未获得授权。
任何想法......? :-)
我的http元素是:
EDITED
Ok, added the dependency to common pool, it works because with the right credentials I no more get the "bad credentials" page.
But I get an HTTP Status 403 - Access is denied.
Seems like my user is authenticated , but isn't authorized.
Any idea...? :-)
My http element is:
<security:http auto-config="true" >
<security:intercept-url pattern="/**" access="ROLE_USER"/>
</security:http>
我有一个测试用户绑定到权限中的USER角色表。
and I have a "test" user that is bind to the "USER" role in the "authorities" table.
谢谢
推荐答案
Commons DBCP依赖于Commons池库因此,您实际上需要下载commons-pool jar文件,并将它们包含在您的路径中。
Commons DBCP relies on the Commons Pools libraries, because of this, you actually need to download the commons-pool jar files, and include them in your path.
您可能还需要下载commons-collections包。
You may also need to download the commons-collections package, too.
这篇关于jdbc spring security,apache commons dbcp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!