Retrieving username and password from url??

2002-12-02 Thread Abhishek Srivastava
Hi,
Is there a way that I can retrieve the username and password from the url
given as below using a servlet.
https://username:password@hostname/servletname/servlet


Regards,
Abhishek








--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Retrieving username and password from url??

2002-12-02 Thread Peng Tuck Kwok
You could use a regular expression to get the items you want or Tokenize 
the string until you get what you want.

There are several regular expression packages that you can use, which is 
available under the jakarta project or if you are so inclined you can 
use the one that comes with jdk1.4

Abhishek Srivastava wrote:
Hi,
Is there a way that I can retrieve the username and password from the url
given as below using a servlet.
https://username:password@hostname/servletname/servlet


Regards,
Abhishek








--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]






--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Retrieving username and password from url??

2002-12-02 Thread Abhishek Srivastava
I think my question was a little unclear, I mean I'm accessing a servlet
from the web using this URL, and on tomcat side, is there a method exposed
by Httpservlet or any alternative which returns me the username and password
send by the browser like we have the getParameters() to get the parameters
from the url.

regards,
Abhishek

-Original Message-
From: Peng Tuck Kwok [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 02, 2002 2:15 PM
To: Tomcat Users List
Subject: Re: Retrieving username and password from url??


You could use a regular expression to get the items you want or Tokenize
the string until you get what you want.

There are several regular expression packages that you can use, which is
available under the jakarta project or if you are so inclined you can
use the one that comes with jdk1.4

Abhishek Srivastava wrote:
 Hi,
 Is there a way that I can retrieve the username and password from the url
 given as below using a servlet.
 https://username:password@hostname/servletname/servlet


 Regards,
 Abhishek








 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]





--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Retrieving username and password from url??

2002-12-02 Thread Reynir Hübner
Hi, 

Depending on the browser and authentication scheme this will may try to authenticate 
against tomcat. 
There for you should be able to do request.getRemoteUser() on (at least) the first 
request that has the authenticative username:password. 
request.getRemoteUser() only returns the username, you can get the Authentication 
header wich is formed like this in BASIC authentication scheme: 
String user_Password = login+ :+ password;
String encoding  = new String (Base64.encode(user_Password.getBytes()));
String Authentication = Basic  + encoding;

You might be able to do that backwards somehow

Hope it helps
-reynir


 -Original Message-
 From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]] 
 Sent: 2. desember 2002 08:30
 To: [EMAIL PROTECTED]
 Cc: Sunu Joseph
 Subject: Retrieving username and password from url??
 
 
 Hi,
 Is there a way that I can retrieve the username and password 
 from the url given as below using a servlet. 
 https://username:password@hostname/servletname /servlet
 
 
 
 Regards,
 Abhishek
 
 
 
 
 
 
 
 
 --
 To unsubscribe, 
 e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Retrieving username and password from url??

2002-12-02 Thread Andreas Probst
Hi Reynir,

how can you get the Authentication header? As far as I know the
only information you can get is the Principal and the username,
but not the password, neither clear nor encoded.

Andreas


On 2 Dec 2002 at 9:14, Reynir Hübner wrote:

 Hi,

 Depending on the browser and authentication scheme this will may
 try to authenticate against tomcat. There for you should be able
 to do request.getRemoteUser() on (at least) the first request
 that has the authenticative username:password.
 request.getRemoteUser() only returns the username, you can get
 the Authentication header wich is formed like this in BASIC
 authentication scheme: String user_Password = login+ :+
 password; String encoding  = new String
 (Base64.encode(user_Password.getBytes())); String Authentication
 = Basic  + encoding;

 You might be able to do that backwards somehow

 Hope it helps
 -reynir


  -Original Message-
  From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]]
  Sent: 2. desember 2002 08:30
  To: [EMAIL PROTECTED]
  Cc: Sunu Joseph
  Subject: Retrieving username and password from url??
 
 
  Hi,
  Is there a way that I can retrieve the username and password
  from the url given as below using a servlet.
  https://username:password@hostname/servletname /servlet
 
 
 
  Regards,
  Abhishek
 
 
 
 
 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Retrieving username and password from url??

2002-12-02 Thread Reynir Hübner
Hi, 
Try this : 

 String authheader = request.getHeader(authorization);
 
I should point out, that usually sessions are only authenticated once, there for there 
is not authorization header in every request but only the one that is used for 
authentication). Some browsers sometimes try to authenticate every request, I think it 
has to do with cookie settings and more. 

Hope it helps
  -reynir


 -Original Message-
 From: Andreas Probst [mailto:[EMAIL PROTECTED]] 
 Sent: 2. desember 2002 14:09
 To: Tomcat Users List
 Subject: RE: Retrieving username and password from url??
 
 
 Hi Reynir,
 
 how can you get the Authentication header? As far as I know the 
 only information you can get is the Principal and the username, 
 but not the password, neither clear nor encoded.
 
 Andreas
 
 
 On 2 Dec 2002 at 9:14, Reynir Hübner wrote:
 
  Hi,
  
  Depending on the browser and authentication scheme this 
 will may try 
  to authenticate against tomcat. There for you should be able to do 
  request.getRemoteUser() on (at least) the first request 
 that has the 
  authenticative username:password.
  request.getRemoteUser() only returns the username, you can get the 
  Authentication header wich is formed like this in BASIC 
 authentication 
  scheme: String user_Password = login+ :+ password; String 
 encoding  
  = new String (Base64.encode(user_Password.getBytes())); String 
  Authentication = Basic  + encoding;
  
  You might be able to do that backwards somehow
  
  Hope it helps
  -reynir
  
  
   -Original Message-
   From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]]
   Sent: 2. desember 2002 08:30
   To: [EMAIL PROTECTED]
   Cc: Sunu Joseph
   Subject: Retrieving username and password from url??
   
   
   Hi,
   Is there a way that I can retrieve the username and password from 
   the url given as below using a servlet. 
   https://username:password@hostname/servletname /servlet
   
   
   
   Regards,
   Abhishek
   
   
   
   
   
 
 
 --
 To unsubscribe, e-mail:   
 mailto:tomcat-user- [EMAIL PROTECTED]
 For 
 additional commands, 
 e-mail: mailto:[EMAIL PROTECTED]
 
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]