Results 1 to 4 of 4
- 01-03-2008, 03:30 PM #1
Member
- Join Date
- Jan 2008
- Posts
- 4
- Rep Power
- 0
Problem with NTLM ,data not posting to the server
Hi all,
we are making use of NTLM authentication techninuqe.
we are making use fo JSF with ADF custom components technology.
IT is throws an Exception when we click on any action button
its throws Exception : java.io.EOFException.....
public CheckAuthorisation()
{
try
{
String auth = request.getHeader("Authorization");
if (auth == null)
{
response.setStatus(response.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "NTLM");
return;
}
if (auth.startsWith("NTLM "))
{
// System.out.println("Auth"+auth);
byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substri ng(5));
int off = 0, length, offset;
String s;
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() );
response.setStatus(response.SC_UNAUTHORIZED);
return;
}
else if (msg[8] == 3)
{
off = 30;
length = msg[off+17]*256 + msg[off+16];
// System.out.println("length::" + length);
offset = msg[off+19]*256 + msg[off+18];
// System.out.println("offset::" + offset);
s = new String(msg, offset, length);
//out.println(s + " ");
// System.out.println("s::"+s);
}
else
return;
length = msg[off+1]*256 + msg[off];
// System.out.println("Second length::" + length);
offset = msg[off+3]*256 + msg[off+2];
// System.out.println("Second offset::" + offset);
s = new String(msg, offset, length);
//out.println(s + " ");
// System.out.println("Second S::" + s);
Pattern pat = Pattern.compile("[a-z,A-Z,0-9,@,.]+");
Matcher mat = pat.matcher(s);
String s1 = "";
while(mat.find())
s1 = s1+mat.group();
// System.out.println("Got Domain: "+s1);
// out.println(s1);
length = msg[off+9]*256 + msg[off+8];
offset = msg[off+11]*256 + msg[off+10];
s = new String(msg, offset, length);
// System.out.println("Third S::" + s);
pat = Pattern.compile("[a-z,A-Z,0-9,@,.]+");
mat = pat.matcher(s);
s1 = "";
while(mat.find())
s1 = s1+mat.group();
// System.out.println("Got name: "+s1);
if(s.indexOf('.')!=-1)
{
// System.out.println("dots!!!");
}
s.replaceAll("[.]","");
StringBuffer userName=new StringBuffer();
for(char c:s.toCharArray())
{
if((int)c!=0)userName.append(c);
}
out.println("Logged User Name is "+userName);
com.tristar.servicedesk.view.handler.ADSHandler adsHandler=new com.tristar.servicedesk.view.handler.ADSHandler();
out.println("Role is "+adsHandler.IdentifyRolesFromADS(userName.toStrin g()));
String userRole=adsHandler.IdentifyRolesFromADS(userName. toString());
// System.out.println("userRole::"+userRole);
// System.out.println("userName::"+userName);
session.setAttribute("loggedUserName",userName);
session.setAttribute("loggedUserRole",userRole);
// System.out.println("user name from session::"+session.getAttribute("loggedUserName")) ;
//response.setStatus(HttpServletResponse.SC_UNAUTHOR IZED);
System.out.println("Request info "+request.getHeaderNames());
if(session.getAttribute("status")==null)
{
session.setAttribute("status","value");
if(userRole!=null)
response.sendRedirect("faces/app/searchRequest.jsp");
else
// response.sendRedirect("faces/app/searchRequest.jsp");
response.sendRedirect("faces/unauthorisation.jsp");
}
}
}
catch (Exception e)
{
session.setAttribute("loggedUserName",null);
session.setAttribute("loggedUserRole",null);
System.out.println("Exception due to "+e);
e.printStackTrace();
}
}
This is my above code.
its working for everything.
problem only when file uploading comes into discussion.
thanks in advance,
ravi.
- 01-03-2008, 03:31 PM #2
Member
- Join Date
- Jan 2008
- Posts
- 4
- Rep Power
- 0
Problem with NTML authentication ?
- 01-03-2008, 03:32 PM #3
Member
- Join Date
- Jan 2008
- Posts
- 4
- Rep Power
- 0
wat is transient
- 01-03-2008, 03:33 PM #4
Member
- Join Date
- Jan 2008
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Sql server connection problem
By tanvirtonu in forum JDBCReplies: 1Last Post: 03-31-2008, 12:46 PM -
querying russian data from db problem
By mr_empty in forum JDBCReplies: 0Last Post: 03-04-2008, 07:56 AM -
Posting codes and help
By Java_Man in forum New To JavaReplies: 2Last Post: 02-16-2008, 03:15 AM -
Problem for iReport (Data Source )
By tlgkumar in forum Advanced JavaReplies: 1Last Post: 11-27-2007, 07:39 AM -
Plugin to Prevent Newbies from Posting to Wrong Forum
By levent in forum Suggestions & FeedbackReplies: 1Last Post: 08-12-2007, 01:07 PM


LinkBack URL
About LinkBacks

Bookmarks