• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http Basic Authentication for localhost(apache server)

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic