| Author |
Http Basic Authentication for localhost(apache server)
|
naveen yadav
Ranch Hand
Joined: Oct 23, 2011
Posts: 380
|
|
hi ranchers ,
i have tried to access a resource located on Apache-Coyote server on my localhost:8080. The server requires me to authenticate with credentials with Basic scheme.
WWW-Authenticate :Basic realm="Tomcat Manager Application".
i have gone throught the RFC for HTTP Basic authentication , whcih state that a
Authorization requst header field is to be set with appropriate credentials(user_name and password)
ok. i can do that by
Further it state that
To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64
encoded string in the credentials.
now it seems that "Basic nav:111" string is to be encoded in base64.
but how can i do that ?
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8145
|
|
naveen yadav wrote:
now it seems that "Basic nav:111" string is to be encoded in base64.
but how can i do that ?
There are many libraries out there which have an API to help you convert the string to a base64 string. A google search for base64 java library will show up some of them.
|
[My Blog] [JavaRanch Journal]
|
 |
naveen yadav
Ranch Hand
Joined: Oct 23, 2011
Posts: 380
|
|
Thanks Jaikiran Pai. i'm using the Apache's common-codec library for Base64 encoding.
But still getting the 401:unauthorized error
here is code running in Eclipse
and
|
 |
 |
|
|
subject: Http Basic Authentication for localhost(apache server)
|
|
|