On 4/23/2018 11:46 AM, zahi.f...@gmail.com wrote:
I used the “manager” role for basic auth. While testing the web service with 
postman, I entered my user name and password.
Yet, I got unauthorized message (401)..

I couldn’t find any explanation for this issue..


What do the log files say?

-Terence



On 23 Apr 2018, at 19:41, Christopher Schultz <ch...@christopherschultz.net> 
wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Zahi,

On 4/23/18 10:13 AM, zahi.f...@gmail.com wrote:
I just copied my users section in the tomcat-users. There is more
code - Tomcat users tag.. that shouldn’t be the problem cause I can
enter to the tomcat manager page
Well, if it shouldn't be a problem then why are you having a problem?

- -chris

On 23 Apr 2018, at 16:45, Christopher Schultz
<ch...@christopherschultz.net> wrote:

Zahi,

On 4/23/18 9:38 AM, Zahi Fail wrote: I'm working with Tomcat
9.0.6 version as my servlet, Throughout my jax-rs project i
have tried to create basic authentication.

While i'm trying to access a post method without the basic
auth. it all working well (I got the 200 message from the
HTTP server). But, after adding the basic auth. my user name
and password doesn't work from some reason..


This is the following code from my web.xml file:

<?xml version = "1.0" encoding = "UTF-8"?> <web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://java.sun.com/xml/ns/javaee";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";
id="WebApp_ID" version="3.0"> <display-name>User
Management</display-name> <servlet> <servlet-name>Jersey
RESTful Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servl
et-
class>

<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.journaldev.jaxws.beans</param-value>
</init-param> </servlet> <servlet-mapping>
<servlet-name>Jersey RESTful Application</servlet-name>
<url-pattern>/rest/*</url-pattern> </servlet-mapping>
<security-constraint> <web-resource-collection>
<web-resource-name>simple web resource</web-resource-name>
<url-pattern>/rest/Traffic/*</url-pattern>
<http-method>POST</http-method> </web-resource-collection>
<auth-constraint> <role-name>manager</role-name>
</auth-constraint> <user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint> </security-constraint> <login-config>
<auth-method>BASIC</auth-method> </login-config> </web-app>



*and in the tomcat-user.xml i have updated the code as below:
*

<role rolename="manager-gui"/> <role
rolename="manager-status"/> <role rolename="manager-script"/>
<role rolename="manager"/> <user username="tomcat"
password="s3cret" roles="manager-gui"/> <user
username="admin" password="falcon" roles="manager"/>
Your tomcat-user.xml file is not a valid XML document.

-chris
---------------------------------------------------------------------


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

---------------------------------------------------------------------


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlreDLYACgkQHPApP6U8
pFhQJg/+MP//p9106wLrS3EG5aqkt6NpG4iZyL7btCRIb1iMQuhF0HGG/mSgtvWe
3/kyfAe81aiBxC6nfhEx9DepSAQ24/6nYLE5vEtInnKZelY7ehaH4/nDb6DVJMer
8C/onpnz7NValh+pecEj4mfhMoWc40poH+L4Ry1u8oiWzjjFW6g8QB37Ac759x7L
9GCHYK88z4fGFdDFSxVGsNMyy+FHgy3Dz+gJplAFXtIctTD7QC1Rk1Js+ioivj7F
6/fC9v0OoApqFAAKKDP/gsYhRP2KAFqgasFnLRU90ic8YLGtJ7GDayhi3EIEgNLz
GZIR1VwN0IqYDZ935Bxw1p/gRu6tgSgZS8MOF4jV64RST04p1LymEdmvcR7+N8HX
BYRJLYOChI2PjAfh7WmCHXSP8KK8hHA4bWKtuWB0XhLIvurHWE88x2ZwuqnabCAF
9Zh8XLpU7NLjTZGBVXYQPe0/xGVvElWSkVaX8TrIyVNY7qf9Nri+pgOLBdIz3AGy
COsoP3o9pMn8CkQPpA0Fq503sUU7GuMZByuGpyWayDxen1P4Gpv5o/YdDivUnJJ2
56NBksROXNVYHDT+mJox/6v7UNya5ssrEIquUtnEzr+3ZdChWtRXzglMPPUWVcdm
Ms5XDhKOUUKlHNynT7i+a3eeIOpn4UJZqJiBtp19IFPfN4XcSh4=
=ch87
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to