FileRealm Glassfish身份验证4.转发到特定页面

时间:2015-07-06 10:22:17

标签: glassfish

当我从testlog.jsp登录并用不正确的密码填写表单时,我被转移到err.jsp。所以授权机制运作良好。 当我用登录名和密码填写表格时,我移动到index.jsp,但我想转到页面git.html。

有人有类似的项目吗?

顺便说一句。我使用glassfish 4.1和netbeans 8.0.2。

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>stronaretail</realm-name>
    <form-login-config>
        <form-login-page>/testlog.jsp</form-login-page>
        <form-error-page>/err.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-constraint>
    <web-resource-collection>
        <web-resource-name>Authorization Mechanism</web-resource-name>
        <url-pattern>/git.html</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>administrator</role-name>
    </auth-constraint>
    </security-constraint>
</web-app>

的glassfish-web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <class-loader delegate="true"/>
    <security-role-mapping>
        <role-name>administrator</role-name>
        <group-name>admin</group-name>
    </security-role-mapping>
</glassfish-web-app>

0 个答案:

没有答案