简体   繁体   English

登录表单到tomcat中受保护的应用程序

[英]Login form to an a secured app in tomcat

I have a normal HTML page in a normal Apache http server ( http://yyy.yyy.yyy.yyy/index.html ), with an authentication form, with that form I need to access with the credentials to an application located in other server with diferent IP , that server have a secured application with tomcat: here is the login form in the apache http server: 我在普通的Apache http服务器( http://yyy.yyy.yyy.yyy/index.html )中具有普通的HTML页面,带有身份验证表单,该表单需要使用凭据访问位于其他具有不同IP的服务器,该服务器具有受保护的具有tomcat的应用程序:这是apache http服务器中的登录表单:

<form method="POST" id="theForm" 
      action="http://xxx.xxx.xxx.xxx:8080/securedapp/j_security_check">
  <input name="j_username" type="text" class="tx_form" id="j_username" size="20" />
  <input name="j_password" type="password" class="tx_form" id="textfield2" size="20" />
  <input name="btn" type="submit" value="login" />
</form>

the submit only works random in chrome and dont work in IE and FF. 提交仅适用于chrome浏览器,不适用于IE和FF。 im doing something wrong? 我做错了什么?

You are missing a submit button. 您缺少提交按钮。 Chrome sends the values even without submit button when you press enter. 当您按Enter键时,即使没有提交按钮,Chrome也会发送这些值。 Firefox and IE don't. Firefox和IE不会。

If you don't want the sumbit button (not recommended), you could try something like 如果您不希望使用sumbit按钮(不推荐),则可以尝试类似

<input type='text' name='bla' onKeyDown="if (window.event.keyCode==13) this.form.submit();">

I recommend installing tamperdata in firefox and then click the "start tamper" button in the tamperdata window. 我建议在firefox中安装篡改数据 ,然后在篡改数据窗口中单击“启动篡改”按钮。 Click submit on the forum and then "tamper" the request. 单击论坛上的提交,然后“篡改”请求。 This will allow you to view and modify all of the data in a http request. 这将允许您查看和修改http请求中的所有数据。

There maybe some differences when the request is sent from a remote server vs locally. 从远程服务器与本地发送请求时,可能会有一些差异。 For one the "referer" will be different and some applications check this as a form of CSRF protection. 对于一个“引荐”而言,它会有所不同,某些应用程序将此作为CSRF保护的一种形式进行检查。 Another thing to keep an eye out for is missing get/post variables, you might have forgotten something or it maybe modified with javascript. 需要注意的另一件事是缺少get / post变量,您可能已经忘记了某些内容,或者可能使用javascript对其进行了修改。 Finley make sure that the content-type of the request is the same. Finley确保请求的content-type相同。

This is how you change the content type of a post request: 这是您更改发布请求的内容类型的方式:

<form action="http://xxx.xxx.xxx.xxx:8080/securedapp/j_security_check"
    enctype="multipart/form-data"
    method="post">

Another option is to use Wireshark to capture the http reqeusts generated by chrome/ie/firefox. 另一种选择是使用Wireshark捕获由chrome / ie / firefox生成的http请求。 You can use a diff tool like Meld to compare packets. 您可以使用像Meld这样的差异工具来比较数据包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM