Avatar billede fredand Forsker
29. april 2005 - 10:07 Der er 8 kommentarer og
1 løsning

(Tomcat) How to set username and password for SSL to avoid 401

Hello!

I try to access a webservices with SSL. Everything seems to be OK but I get a (401)Unauthorized response. My investigation has led to I suspect that the problem must be that I need to apply the correct username and password.

But what is the correct username and password????

I use Tomcat 5.5.9 and axis.

I have tried with:
user_name
user_pass

My_windows_XP_log_in_user_name
My_windows_XP_log_in_user_pass

keystorePass and the name set in the keystore

But no luck at all.

My code looks like:

SSLSoapWsdlServerServiceLocator sslSoapWsdlServerServiceLocator = new SSLSoapWsdlServerServiceLocator();
SSLSoapWsdlServerSoapBindingStub sslSoapWsdlServerSoapBindingStub = (SSLSoapWsdlServerSoapBindingStub) sslSoapWsdlServerServiceLocator.getSSLSoapWsdlServer(new URL("https://localhost:8443/axis/services/SSLSoapWsdlServer"));
sslSoapWsdlServerSoapBindingStub.setUsername("Frean");
sslSoapWsdlServerSoapBindingStub.setPassword("xxxxxx");
String returned = (String)sslSoapWsdlServerSoapBindingStub.getPrime("someString");
System.out.println( "Soap returned: " + returned );

I do not know where I find the username and password to use. I have not set anything like that in my Tomcat.

So if you know where to find or config this please let me know!!

Best regards
Fredrik
Avatar billede arne_v Ekspert
08. maj 2005 - 20:34 #1
you tell Tomcat to require username/password in web.xml

you define usernames/passwords in conf/server.xml - default is
from tomcat-users.xml but it is easy to configure to use a database
Avatar billede arne_v Ekspert
28. maj 2005 - 17:05 #2
got it working ?
Avatar billede fredand Forsker
29. maj 2005 - 12:15 #3
Hello Arne!

I found user = "tomcat" and password = "tomcat" in file  tomcat-users.xml inside tomcat if I remeber correct.

With that info i upgraded my problem from 401 to 403. I guess that is a bit closer the solution, but as you can see it is not solved.

Best regards

Fredrik
Avatar billede arne_v Ekspert
29. maj 2005 - 12:48 #4
sounds as if the username does not have access according to definitions in web.xml
Avatar billede arne_v Ekspert
29. maj 2005 - 12:50 #5
example

web.xml fragment:

  <security-constraint>
      <web-resource-collection>
          <web-resource-name>Protected web service</web-resource-name>
          <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <auth-constraint>
          <role-name>wsusers</role-name>
      </auth-constraint>
  </security-constraint>
  <login-config>
      <auth-method>BASIC</auth-method>
  </login-config>

tomcat-users.xml fragment:

  <role rolename="wsusers"/>
  <user username="wsuser1" password="hemmeligt" roles="tomcat,wsusers"/>
  <user username="wsuser2" password="hemmeligt" roles="tomcat,wsusers"/>
Avatar billede arne_v Ekspert
24. juli 2005 - 17:24 #6
status ?
Avatar billede fredand Forsker
24. juli 2005 - 23:17 #7
Hello Arne!

I have been very busy with some stuff but I will try to test this soon!

Thanks a lot!

Best regards
Fredrik
Avatar billede fredand Forsker
29. december 2010 - 20:56 #8
Hello Arne!

I really should need to clean up all my questions.

I think you should claim the points in this, especially to your comment at: Skrevet søn. d. 29. maj 2005 kl. 12:50:36

Best regards
Fredrik
Avatar billede arne_v Ekspert
29. december 2010 - 21:07 #9
ok
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester