Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a app that uses Jespa to do transparent SSO. I'm using the NtlmSecurityProvider. In my code, when I get the username looks like this: "DOMAINNAME\username"


<% out.println(request.getRemoteUser()); %>

prints this: MYDOMAIN\myusername

Here's my question:

Will it always look like that, with the domain name and the username? or is it just the way our user accounts in our domain are set up? Like, if I switched to a different windows domain, could I potentially get just the username without the domain and the backslash?


share|improve this question
up vote 3 down vote accepted

This is probably more a support question for the Jespa folks. The output is reliant on the behavior of their API.

In general, though, best practice for Windows is to always use DOMAIN\username format or username@domain format.

If you're worried about the format changing then I would suggest you write a class / method / utility that knows how to parse the results of getRemoteUser() and returns the parts to your app as you deem necessary. Then if it ever does change you only have to change on piece of code to fix your app.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.