Announcement

Collapse
No announcement yet.

Custom Logon Script Assistance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Logon Script Assistance

    Trying to test the custom logon script option using curl on the same machine that nxfilter is running on. I am not getting a success nor a failure response. After I get the success message, I will remove the localhost restriction.

    When I run the following I get no output (janeway is an existing test user)
    Code:
    curl "http://localhost/example/login_user.jsp?ip=192.168.0.100&uname=janeway"
    Here is the login_user.jsp contents. I plan on updating this to allow none local host IPs to connect, and then to get the IP using getRemoteAddr.

    Code:
    <%@include file="../include/lib.jsp"%>
    <%
    /*
    You can call this page using the following url.
    
      http://localhost/example/login_user.jsp?ip=192.168.0.100&uname=john
    
    It's limited to localhost for security reason but you can change it according
    to your network environment.
    */
    
    // Only localhost access allowed.
    
    if(request.getRemoteAddr().startsWith("127.0.0.1")){
            out.println(request.getRemoteAddr());
            return;
    }
    
    
    // Get params.
    String ip = paramString("ip");
    String uname = paramString("uname");
    
    /*
    If you think there's a possibility of IP spoofing from your users then it's better
    to get the IP address from the HTTP connection itself.
    */
    //String ip = request.getRemoteAddr();
    //String uname = paramString("uname");
    
    
    UserLoginDao dao = new UserLoginDao(request);
    if(dao.createIpSession(ip, uname)){
            out.println("Login success.");
    }
    else{
            out.println("Login error!");
    }
    %>

  • #2
    You probably don't have /example directory under /nxfilter/guipack/sandwatch that is the new GUI directory. You need to copy it from /nxfilter/webapps.

    Comment


    • #3
      Originally posted by support200 View Post
      You probably don't have /example directory under /nxfilter/guipack/sandwatch that is the new GUI directory. You need to copy it from /nxfilter/webapps.
      This was it, I'm now getting success and failure messages. Thanks!

      Comment

      Working...
      X