S
studentxxx
Gast
Hi, der Loginvorgang klappt bei mir nicht. Obwohl der User in der Datenbank drin steht, bekomme ich ständig die error.html Seite zu sehen. Von Eclipse bekomme ich keine Fehlermeldung. Ich finde den Fehler nicht. Könnt ihr mir bitte helfen. Folgende Einstellungen habe ich vorgenommen. (Ich benutze JBOSS 4)
in security-login.config
<application-policy name = "test">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginMo dule"
flag = "required">
<module-option name = "dsJndiName">java:/jdbc/test</module-option>
<module-option name = "principalsQuery">SELECT Password FROM Principals WHERE PrincipalID=?</module-option>
<module-option name = "rolesQuery">SELECT Role, Rolegroup FROM Roles WHERE PrincipalID=?</module-option>
</login-module>
</authentication>
</application-policy>
in web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>myResources</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>administrator</role-name>
<role-name>moderator</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>test</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Rechte für Admin</description>
<role-name>administrator</role-name>
</security-role>
<security-role>
<description>Rechte für Moderator</description>
<role-name>moderator</role-name>
</security-role>
<security-role>
<description>Rechte für Student</description>
<role-name>student</role-name>
</security-role>
in jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>java:/jaas/test</security-domain>
</jboss-web>
in mssql-ds
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/test</jndi-name>
<connection-url>jdbc:sqlserver://localhost;DatabaseName=TEST</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver </driver-class>
<user-name>root</user-name>
<password>root</password>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<metadata>
<type-mapping>MS SQLSERVER2000</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
Dann habe ich in meiner Datenbank 2 Tabellen mit folgenden Attributen
Principals
PrincipalID
Password
Roles
PrincipalID
Roles
Rolegroup
Und dann natürlich die beiden Seiten (login.html und und error.html, die ich jetzt nicht mit aufschreibe). FileBased (UsersRolesLoginModul) hatte einwandfrei funktioniert, ich habe mir 100 mal die Einstellungen angeguckt, ob irgendein Verweis falsch ist etc. aber ich finde nichts und verstehe nicht warum ich nach dem Submit ständig die error.html zu sehen bekomme. Der User, mit dem ich mich einlogge ist auch in der Datenbank drin und hat die Rolle "administrator".
Mit der Bitte um schnelle Hilfe
Gruß
in security-login.config
<application-policy name = "test">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginMo dule"
flag = "required">
<module-option name = "dsJndiName">java:/jdbc/test</module-option>
<module-option name = "principalsQuery">SELECT Password FROM Principals WHERE PrincipalID=?</module-option>
<module-option name = "rolesQuery">SELECT Role, Rolegroup FROM Roles WHERE PrincipalID=?</module-option>
</login-module>
</authentication>
</application-policy>
in web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>myResources</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>administrator</role-name>
<role-name>moderator</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>test</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Rechte für Admin</description>
<role-name>administrator</role-name>
</security-role>
<security-role>
<description>Rechte für Moderator</description>
<role-name>moderator</role-name>
</security-role>
<security-role>
<description>Rechte für Student</description>
<role-name>student</role-name>
</security-role>
in jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>java:/jaas/test</security-domain>
</jboss-web>
in mssql-ds
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/test</jndi-name>
<connection-url>jdbc:sqlserver://localhost;DatabaseName=TEST</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver </driver-class>
<user-name>root</user-name>
<password>root</password>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<metadata>
<type-mapping>MS SQLSERVER2000</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
Dann habe ich in meiner Datenbank 2 Tabellen mit folgenden Attributen
Principals
PrincipalID
Password
Roles
PrincipalID
Roles
Rolegroup
Und dann natürlich die beiden Seiten (login.html und und error.html, die ich jetzt nicht mit aufschreibe). FileBased (UsersRolesLoginModul) hatte einwandfrei funktioniert, ich habe mir 100 mal die Einstellungen angeguckt, ob irgendein Verweis falsch ist etc. aber ich finde nichts und verstehe nicht warum ich nach dem Submit ständig die error.html zu sehen bekomme. Der User, mit dem ich mich einlogge ist auch in der Datenbank drin und hat die Rolle "administrator".
Mit der Bitte um schnelle Hilfe
Gruß