i was working in a project with j2ee/jsp and asp format
in a MVC model in Websphere application Developer.
well the code started by prompting user to enter user name and password
and then checks against the active directory and then displays the page.
this is a pretty straight forward thing which run well in mozilla, IE, and Netscape navigator.
But, when checked against the safari in mac, after entering user name and password nothing gets displayed.
when i checked IDE it showed some errors.
As i further checked, i found that the variable for username was blank.
what could have gone wrong?
6 2368
Heya, nicetohaveyou. Welcome to TSDN!
I'm going to go ahead and move this thread to the Java forum, where our resident Experts will be better able to help you out.
Heya, nicetohaveyou. Welcome to TSDN!
I'm going to go ahead and move this thread to the Java forum, where our resident Experts will be better able to help you out.
actually the code checks for the active directory
actually the code checks for the active directory
You'll need to post the code then.
initialy i am using a custom filter.
the code is -
public String getLoginUserName(HttpServletRequest request,HttpServletResponse response) throws GetUserIdException
-
{
-
String loginName = "";
-
String auth = request.getHeader("Authorization");
-
try
-
{
-
if (auth == null) {
-
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-
response.setHeader("WWW-Authenticate", "NTLM");
-
return "";
-
}
-
else if (auth.startsWith("NTLM ")) {
-
byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(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(HttpServletResponse.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);
-
}
-
else
-
return "";
-
length = msg[off+1]*256 + msg[off];
-
offset = msg[off+3]*256 + msg[off+2];
-
loginName = new String(msg, offset, length);
-
length = msg[off+9]*256 + msg[off+8];
-
offset = msg[off+11]*256 + msg[off+10];
-
loginName = new String(msg, offset, length);
-
}
-
}
-
catch(Exception ex)
-
{
-
ANSLogger.logInfo("HeaderFilterDef:getLoginUserName::GetUserIdException occured....");
-
ex.printStackTrace();
-
ANSLogger.logInfo(ex.getMessage());
-
throw new GetUserIdException(AnsErrorCode.GET_USERID_EXCEPTION,"");
-
}
-
return loginName; }
-
--------------------------------------------------------------------------------
now, this gives the login name and domain name for all browsers except mac.
So i thought of adding a code which will specifically execute in case it is called from any browser(safari or IE) in a mac.
so i thought of using request.getRemoteUser() but to my misery it was giving null.
when i tried it without custom filter and used a standard ntlmHttpFilter in the DD, it simply worked but as you know. In the filter you need to specify the domain controller.
Now, if the machines from different domains try to access the code, it will not work. However the above code with custom filter works fine for all domains.
So, in order to balance between the two, i though of adding request.getRemoteUser() to the above code which will be executed when the browser is safari or IE for mac.
So, i used String str = request.getHeader("user-agent"); -
//"Macintosh"
-
if(str.indexOf("Macintosh") > -1)
and chip in
request.getRemoteUser();
Lets get one thing straight, since this thread is being bounced all over.
You are writing this in java correct? Or is it C#?
It looks like java to me.
If I had to guess why it fails on a MAC computer (and probably on a *nix system) is because NTLM is a microsoft protocol.
Try using one of the standard protocols?
Possibly like this: -
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-
response.setHeader("WWW-Authenticate", "Negotiate");
-
response.setHeader("WWW-Authenticate", "NTLM");
-
Or however you would get both of them in there
Sign in to post your reply or Sign up for a free account.
Similar topics
by: liberty |
last post by:
Hi,
I have looked everywhere to try and solve my problem-- looked at W3C
DOM Compatibility charts, read articles, tried debuggers, and still my
script is not working.
The problem I have is this. ...
|
by: dejavue82 |
last post by:
Dear Asp.net users,
I have seen some people comment that their asp.net websites render
differently with various web browsers. Are they doing somthing wrong?
In particilar,
1) I am wondering...
|
by: hangar18 |
last post by:
Hi,
Is there any standard approach /best practices to achieve browser
compatibility.
We have a web application which contains both ASP and ASP.NET pages.
We would like to achieve complete browser...
|
by: CMM |
last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My
superiors have decided that it would be nice if we ensured the site worked
on all the major platforms (as they see it: IE,...
|
by: Edward |
last post by:
Hi All,
I am having huge problems with a very simple dotnet framework web page
(www.gbab.net/ztest3.aspx) , it does NOT render correctly under Apple's
Safari. The DIV's do not align amd float as...
|
by: David Golightly |
last post by:
This is just a quick poll for all you web devs out there: What
browsers do you test on/are concerned about compatibility with?
Obviously, you're going to test on current-generation browsers such...
|
by: Tom |
last post by:
I have an oo-type javascript program running perfectly on IE 6.0+, FF
1.5+, and Opera 7+ on Windows 98+, Linux (RH 9, FC 6), and Mac OS X.
4. As usual, the Safari browser is not working correctly,...
|
by: Diogenes |
last post by:
Several articles I read recently regarding the demise
of Netscape Navigator stated that Firefox had managed
to get a 16% market share and that IE still has over 80%
of the eyeballs.
Yet my...
|
by: PianoMan64 |
last post by:
Hey Experts,
I'm not sure how to get around this, and any help would be most greatfull. I have an issue with having a CSS menu that displays correctly in IE and not correctly in Firefox 3.0.3,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |