Skip to Content
avatar image
Former Member

j_security_check

Hi,

Would anyone please be able to shed light on the following:

When a web-application uses "j_security_check" , where does it store the name of the original page requested by the user (the one to which user should be redirected after a successful login ) ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 17, 2011 at 04:47 AM

    Hi,

    I am not 100% about SAP but application server usually creates a HTTP session object and stores it there. Check this non SAP [example|http://roneiv.wordpress.com/2008/02/18/jaas-authentication-mechanism-is-it-possible-to-force-j_security_check-to-go-to-a-specific-page/].

    Cheers

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello

      I have literally just set this up myself and it is working.

      What I did was to create a redirect.jsp that contains the path that wanted to redirect to eg.

      <%@ page language="java" %>
      <%@ page import = "java.net.URLEncoder" %>
      <%
      	String redirectURL = "";
      
      	// Check if GET Parameter "redirectURL" is availabel
      	redirectURL = request.getParameter ("redirectURL");
      	if (redirectURL != null) {
      				response.sendRedirect ("http://" + redirectURL);
      	} else {
      				response.sendRedirect ("/irj/portal/HR/HR");
      	}
      %>

      In my web.xml I created a "Servlet Mapping" to "redirect.jsp" with URL pattern "/"

      Logon form as follows:

      <%@ page language = "java"%>
      <html>
      	<head>
      		<title>
      			Login Redirect
      		</title>
      	</head>
      	<body>
      	<TABLE WIDTH=500>
      		<TR>
      		<TD>
      
      		<FORM name="logonForm" method="post" action="j_security_check">  
      		  <input name="login_submit" type="hidden" value="on">
      		  <input type="hidden" name="login_do_redirect" value="1"/>
      		  <input name="j_authscheme" type="hidden" value="default">
      				<p>Please enter Username and Password:</p>
      				<table border="0">
      					<tr>
      						<td><p>Username</p></td>
      						<td><input type="text" name="j_username" id="j_username"</td>
      					</tr>
      					<tr>	
      						<td><p>Password</p></td>
      						<td><input type="password" name="j_password" id="j_password"</td>
      					</tr>
      					<tr>
      						<td> </td>
      						<td><input type="submit" name="submit" value="Login" </td>		
      					</tr>
      				</table>
      		</form>
      		</TD>
      		</TR>
      	</TABLE>
      	</body>
      </html>