Forum Stats

  • 3,733,036 Users
  • 2,246,686 Discussions
  • 7,856,486 Comments

Discussions

request.getParameter returns null if i use SSO

3138254
3138254 Member Posts: 1

Hello,

I am using an authorization JSP before proceeding to another JSP. When the authorization is valid, I go to the next JSP. Now there is a drop down box in this next JSP. I select a value from this drop down and submit the form. When I retrieve the value of this drop down in the next JSP using request.getParameter(), it returns null. The problem is, when I don't use the authorization JSP and proceed directly to the next JSP, and select a value from the drop down, and go to the next JSP, the request.getParameter() returns the valid value.

In the authorization JSP, I am using the following code, may be there's the bug.

String auth = request.getHeader("Authorization");

     if (auth == null) {

response.setStatus(response.SC_UNAUTHORIZED);

response.setHeader("WWW-Authenticate", "NTLM");

return;

     }

     if (auth.startsWith("NTLM ")) {

byte[] msg =

new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));

int off = 0, length, offset;

if (msg[8] == 1) {

off = 18;

byte z = 0;

byte[] msg1 =

{(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',

(byte)'S', (byte)'P', z,

(byte)2, z, z, z, z, z, z, z,

(byte)40, z, z, z, (byte)1, (byte)130, z, z,

z, (byte)2, (byte)2, (byte)2, z, z, z, z, //

z, z, z, z, z, z, z, z};

//

response.setStatus(response.SC_UNAUTHORIZED);

response.setHeader("WWW-Authenticate", "NTLM "

+ new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());

return;

}

else if (msg[8] == 3) {

off = 30;

length = msg[off+17]*256 + msg[off+16];

offset = msg[off+19]*256 + msg[off+18];

s = new String(msg, offset, length);

//out.println(s + " ");

}

else

return;

                   

length = msg[off+1]*256 + msg[off];

offset = msg[off+3]*256 + msg[off+2];

s = new String(msg, offset, length);

//out.println(s + " ");

length = msg[off+9]*256 + msg[off+8];

offset = msg[off+11]*256 + msg[off+10];

s = new String(msg, offset, length);

s1=s.toString().trim();

     // Our Logic starts here now that we have the login user name

          char[] temp = s1.toCharArray();

          char[] user_char= temp;

          String userName = "";

          int j=0;

          for(int i=0;i<s1.length();i++){

               if((int)temp!=0){
                    user_char[j]=temp[i];
                    j++;
               }
          }

Please help.

Sign In or Register to comment.