0

when i log from testlog.jsp and fill the form with incorrect password, i am moved to err.jsp. So authorization mechanism working good. when i fill form with login and password correct i moved to index.jsp, but i want to moved to page git.html.

has somebody a similar project??

btw. i use glassfish 4.1 and 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>
  • this will help : http://stackoverflow.com/questions/14279453/redirect-after-realm-authentication-on-glassfish?rq=1 – smoggers Jul 06 '15 at 10:38
  • exist any easier way?? – Muramasa Jul 06 '15 at 10:47
  • you could try setting up a link re-direct within an element on the testlog.jsp page, so that after successful login the application will proceed to carry out that request of following the link. so I assume on /testlog.jsp you have a button or other element that the users clicks on to login with their entered credentials. so within the button tags add something like this might forward onto that page if login successful – smoggers Jul 06 '15 at 10:56
  • have you got any example code ?? – Muramasa Jul 06 '15 at 11:08
  • I don't. I use spring-security to authenticate users and then forward to specific pages which is exemplified in the above link. The suggestion I gave you only requires that one line of code. – smoggers Jul 06 '15 at 11:14
  • ok, i see. But form on the pge :
    Username:


    , and i don't know where i should i put Your line.
    – Muramasa Jul 06 '15 at 11:44
  • Username:


    – smoggers Jul 06 '15 at 11:52
  • this way the button/input looks like a button but acts like a hyperlink – smoggers Jul 06 '15 at 11:53
  • when i fill the form with the corrects dates, i moved to index.jsp. Maybe do You have any idea?? – Muramasa Jul 06 '15 at 12:24
  • change in web.xml: index.jsp to git.html – smoggers Jul 06 '15 at 12:26
  • I can't change this atribute, because it tells application, that after write the address of application, you will forward to the indicated page – Muramasa Jul 06 '15 at 12:55

0 Answers0