我试图在CloudBees中的JavaEE堆栈中运行一个简单的Web应用程序。作为此应用程序的一部分,我定义了一个安全领域,它是一个DataSourceRealm
<login-config>
<auth-method>FORM</auth-method>
<realm-name>ResmanRealm</realm-name>
<form-login-config>
<form-login-page>/welcome.xhtml</form-login-page>
<form-error-page>/welcome.xhtml</form-error-page>
</form-login-config>
</login-config>
我使用本地Glassfish3服务器编写了这个,我在其中根据JDBC资源定义ResmanRealm。在Glassfish3-config-speak中,最终看起来像这样
<auth-realm classname="com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm" name="ResmanRealm">
<property name="jaas-context" value="jdbcRealm"></property>
<property name="encoding" value="Hex"></property>
<property name="password-column" value="password"></property>
<property name="datasource-jndi" value="jdbc/ResManPool"></property>
<property name="group-table" value="V_USER_ROLE"></property>
<property name="user-table" value="USER"></property>
<property name="group-name-column" value="role"></property>
<property name="digest-algorithm" value="SHA-256"></property>
<property name="user-name-column" value="name"></property>
</auth-realm>
所以,这一切都在本地运作。我在Cloudbees中看到,有一个cloudbees xml文件,doco状态是遗留的,但看起来它有一些形式的支持。我找不到的是如何将安全领域定义为配置参数的任何示例。看起来好像是一个资源(在CloudBees中说),你可以在将数据库绑定到应用程序时定义它。但是,一个例子会很好,因为现有的资源示例(至少是我能找到的资源示例)有点笼统。
另外,我的(当前不成功的)应用程序启动的输出日志没有显示正在加载DataSourceRealms?
[#|2013-02-25T11:03:51.319+0000|INFO|glassfish3.1.2|javax.enterprise.system.core.security.com.sun.enterprise.security|_ThreadID=12;_ThreadName=AutoDeployer;|SEC1010: Entering Security Startup Service|#]
[#|2013-02-25T11:03:51.333+0000|INFO|glassfish3.1.2|javax.enterprise.system.core.security.com.sun.enterprise.security|_ThreadID=12;_ThreadName=AutoDeployer;|SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.|#]
[#|2013-02-25T11:03:51.452+0000|INFO|glassfish3.1.2|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|_ThreadID=12;_ThreadName=AutoDeployer;|SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|#]
[#|2013-02-25T11:03:51.461+0000|INFO|glassfish3.1.2|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|_ThreadID=12;_ThreadName=AutoDeployer;|SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|#]
[#|2013-02-25T11:03:51.483+0000|INFO|glassfish3.1.2|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|_ThreadID=12;_ThreadName=AutoDeployer;|SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.|#]
[#|2013-02-25T11:03:51.498+0000|INFO|glassfish3.1.2|javax.enterprise.system.core.security.com.sun.enterprise.security|_ThreadID=12;_ThreadName=AutoDeployer;|SEC1011: Security Service(s) Started Successfully|#]
所以,如果有人在CloudBees中的JavaEE堆栈中定义DataSourceRealms成功,我会欣赏正确方向的任何推动。感谢您的任何信息。
答案 0 :(得分:2)
CloudBees现在支持Glassfish3和Glassfish4堆栈上的JaaS身份验证和安全领域,如下所示:
请注意,Glassfish3和Glassfish4的 CloudBees安全领域完全基于JdbcRealms ,这似乎是您的需要。
答案 1 :(得分:0)
基于容器的身份验证在CloudBees堆栈上不可用,但由于遗留原因而不能用于tomcat6。首选方法是使用安全框架(spring-security或任何其他)来检测应用程序