Hello,

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</servlet-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"/>



On Mon, Apr 23, 2018 at 4:34 PM, Olaf Kock <tom...@olafkock.de> wrote:

>
>
> On 23.04.2018 14:49, Zahi Fail wrote:
>
>> This is the following code from my web.xml file:
>>
>>
>>
>>
>>
> Images are the least popular medium to communicate code. And on this list,
> this is actually enforced: Images are stripped. Please post the actual text
> - that should be even easier than creating screenshots.
>
> Olaf
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to