我正在使用htmlunit对我的应用程序进行一些浏览器测试。作为其中一部分,我想将屏幕内容与应用服务层返回的内容进行比较。我正在使用Wildfly 8,Java 7和注释。我正在通过Eclipse运行htmlunit。我使用MD5和base64将密码存储在我的数据库中。我可以使用我的JAAS模块通过网站登录应用程序,但是当我尝试运行我的测试时,我得到JBAS013323:用户无效。
这是相关文件。
jboss-ejb-client.properties
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port=8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true
remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
remote.connection.default.username=mywildflyusername
remote.connection.default.password=password
jndi.properties
java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=http-remoting://localhost:8080
java.naming.security.principal=myappusername
java.naming.security.credentials=password
java.naming.security.authentication=simple
jboss.naming.client.ejb.context=true
摘自standalone.xml。对于http-remoting-connector,我尝试过ApplicationRealm,CampaignerRealm和CampaignerJaasRealm没有运气。
<security-realms>
<security-realm name="CampaignerRealm">
<authentication>
<properties path="campaigner-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="campaigner-groups.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
<security-realm name="CampaignerJaasRealm">
<authentication>
<jaas name="campaigner-policy"/>
</authentication>
</security-realm>
<security-realm name="ApplicationRealm">
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
</security-realms>
<subsystem xmlns="urn:jboss:domain:ejb3:2.0">
<default-security-domain value="campaigner-policy"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:remoting:2.0">
<endpoint worker="default"/>
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:security:1.2">
<security-domains>
<security-domain name="campaigner-policy" cache-type="default">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="java:/jdbc/CampaignerDS"/>
<module-option name="principalsQuery" value="SELECT ..."/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="base64"/>
<module-option name="rolesQuery" value="SELECT ..."/>
</login-module>
</authentication>
</security-domain>
</security-domains>
</subsystem>
EJB方法:
@Transactional
@EnableTransactionManagement
@TransactionManagement(value = TransactionManagementType.CONTAINER)
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
@Stateless
@Interceptors(SpringBeanAutowiringInterceptor.class)
@DeclareRoles("Security Admin")
public class SecurityServiceBean extends AbstractCampaignerServiceImpl implements
SecurityServiceLocal, SecurityServiceRemote
{
@Override
@RolesAllowed("Security Admin")
public QueryResults<UserRegistrationQueryResult> find(
UserRegistrationResultQuery query) throws ApplicationException
{
}
}
我错过了什么?