[英]amazon beanstalk tomcat basic authentication
I have an application in java that i have recently migrated to Amazon AWS, Beanstalk with tomcat7 and a MySQL database (RDS). 我有一个Java应用程序,最近已迁移到Amazon AWS,带有tomcat7的Beanstalk和一个MySQL数据库(RDS)。
I want to incorporate the basic Tomcat authentication and I have created the following files under WEB_INF: 我想合并基本的Tomcat身份验证,并在WEB_INF下创建了以下文件:
web.xml web.xml中
<security-constraint>
<display-name>UserConstraint</display-name>
<web-resource-collection>
<web-resource-name>UserConstraint</web-resource-name>
<description/>
<url-pattern>/text.txt</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>authz-user</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>file</realm-name>
</login-config>
<security-role>
<description>Application user role</description>
<role-name>authz-user</role-name>
</security-role>
users.xml users.xml中
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
<role rolename="authz-user"/>
<user username="name" password="pass" roles="authz-user"/>
</tomcat-users>
WEB-INF/.ebextensions/context.xml WEB-INF / .ebextensions / context.xml的
<?xml version='1.0' encoding='utf-8'?>
<Context antiJARLocking="true" path="/APPNAME>
<WatchedResource>WEB-INF/users.xml</WatchedResource>
</Context>
I get the login request but user/pass is not accepted. 我收到登录请求,但不接受用户/密码。 I arrived to this from different sources, so I am not sure whether how it should be done in this environment.
我来自不同的来源,所以我不确定在这种环境下是否应该这样做。 How can I get the users to be accepted?
如何使用户被接受? Is ther another way of creating the users?
这是创建用户的另一种方法吗?
Several errors found: 找到几个错误:
.ebextensions folder must be in the ROOT of the web application. .ebextensions文件夹必须位于Web应用程序的ROOT中。
server-update.config file in this folder must contain: 此文件夹中的server-update.config文件必须包含:
container_commands:
replace-config:
command: "cp .ebextensions/tomcat-users.xml /usr/share/tomcat7/conf/tomcat-users.xml"
users.xml renamed as tomcat-users.xml. users.xml重命名为tomcat-users.xml。
Now it works. 现在可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.