java - Yodlee 示例应用卡在 "Checking Cobrand Login Configurations";无法登录

标签 java apache tomcat server yodlee

我的目标是:

我正在尝试为需要能够以编程方式读取我的银行帐户信息的应用程序设置 Yodlee。

我的问题是:

我能够构建和部署 YodleeSampleApp1.1.WAR,如来自 https://developer.yodlee.com/API_Resources/Yodlee_Sample_App_Getting_Started_Guide 的 Yodlee“入门指南”中所述.当我在我的 Windows 机器上的 Tomcat 7 服务器中部署 WAR 文件时,它运行良好,一切都很完美。但是,当我将 WAR 通过电子邮件发送给我自己的服务器并从服务器部署它时,我无法登录该应用程序并且它永远停留在 "Checking Cobrand Login Configurations" 上。 .我尝试在服务器本身上构建 WAR,但没有区别也没有骰子。

我的服务器设置是这样的:

我有一台运行 Ubuntu 18.04 和 Tomcat 9.0.10 的家庭服务器,在 Apache 2.4.29 之后使用 Let's Encrypt 证书进行 HTTPS 请求。

Tomcat的server.xml设置为只允许来自127.0.0.1的连接,意思是希望只有Apache可以连接到它,然后Apache负责处理所有的HTTPS请求。

Ubuntu 的 UFW 防火墙仅对 Apache 的端口 80 和 443 上的传入 TCP 协议(protocol)和 SSH 的端口 22 上的 TCP 协议(protocol)开放,默认情况下允许传出请求。

我的无线路由器设置为将端口转发到我的服务器机器上,以便 HTTP 请求转到端口 80,HTTPS 请求转到端口 443,以便 Apache 接收它们。

到目前为止我已经尝试过:

  • 禁用 Apache 并直接从 Tomcat 运行应用程序,同样的问题。
  • 禁用 ufw/Uncomplicated FireWall,它不起作用,吓到我了。
  • 故意使用错误的联合品牌凭据构建 WAR,这仍然得到相同的结果,因此我知道我的应用程序实例无法与 Yodlee 的凭据服务器通信。

文档是:

Tomcat的server.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    -->
    <!-- Note:  A "Server" is not itself a "Container", so you may not
         define subcomponents such as "Valves" at this level.
         Documentation at /docs/config/server.html
     -->
    <Server port="8005" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
      <!-- Security listener. Documentation at /docs/config/listeners.html
      <Listener className="org.apache.catalina.security.SecurityListener" />
      -->
      <!--APR library loader. Documentation at /docs/apr.html -->
      <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
      <!-- Prevent memory leaks due to use of particular java/javax APIs-->
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

      <!-- Global JNDI resources
           Documentation at /docs/jndi-resources-howto.html
      -->
      <GlobalNamingResources>
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users
        -->
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
      </GlobalNamingResources>

      <!-- A "Service" is a collection of one or more "Connectors" that share
           a single "Container" Note:  A "Service" is not itself a "Container",
           so you may not define subcomponents such as "Valves" at this level.
           Documentation at /docs/config/service.html
       -->
      <Service name="Catalina">

        <!--The connectors can use a shared executor, you can define one or more named thread pools-->
        <!--
        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
            maxThreads="150" minSpareThreads="4"/>
        -->
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"

    address="127.0.0.1"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->

<!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector> -->


    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3"

address="127.0.0.1"

 redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

YodleeSampleApp1.1 的 index.html:

<!--
 Copyright (c) 2017 Yodlee, Inc. All Rights Reserved.
 -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Yodlee Sample App 1.1</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

    <!-- Latest compiled JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>

<body>

<script>

$(document).ready(function(){

    //Initialize Yodlee Sample app - makes call to servlet to ensure cobrand login is successful.

    $.get( "/YodleeSampleApp1.1/YodleeSampleApp",{ action: "init"} )
      .done(function( data ) {

          data = data.replace(/\'/g, '\"');

          var responseObj = jQuery.parseJSON(data);

          if(responseObj && responseObj.cobSession){
              $("#initCheck").append("<p><strong>Cobrand Configuration Check Successful!</strong></p><p>Use test accounts from API Dashboard to login</p>");

              $('#submitButton').prop('disabled', false);

          }else{

              $("#initCheck").removeClass("alert-info");
              $("#initCheck").addClass("alert-danger");

              if(responseObj && responseObj.error){

                  $("#initCheck").append("<p>"+responseObj.message+"</p>");

              }else{
                  $("#initCheck").append("<p>Error during initialization. Please check settings in config.properties and user credentials</p>");
              } 
          }

    }); 

    //User login
    $('#submitButton').click(function() {

        window.console.log('submitButton');

            var userName = $("#username").val();
            var password = $("#password").val();
            $('#submitButton').prop('disabled', true);
            $('#submitButton').html("Loading...");

          $.post( "/YodleeSampleApp1.1/YodleeSampleApp",{ username:userName, password:password} )
          .done(function( data ) {

              data = data.replace(/\'/g, '\"');
              var dataObj = jQuery.parseJSON(data);

              if(dataObj && dataObj.error && dataObj.error == "false"){
                  window.location.href="accounts.html";
              }else{
                  $("#initCheck").removeClass("alert-info");
                  $("#initCheck").addClass("alert-danger");
                  $("#initCheck").append("<p>Error in User login, please check your test user credentials (from Yodlee API Dashboard).</p>");

                  $('#submitButton').prop('disabled', false);
                  $('#submitButton').html("Login");


              }

           });  

    });


    $("#username").keyup(function(event){
        if(event.keyCode == 13) {
            $("#submitButton").click();
        }
    });


    $("#password").keyup(function(event){
        if(event.keyCode == 13) {
            $("#submitButton").click();
        }
    });


});

</script>
    <section>
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="https://developer.yodlee.com/"> <img
                        alt="Brand"
                        src="https://developer.yodlee.com/assets/img/footer-logo.png">
                    </a>
                </div>
                <div class="col-md-6">
                    <h2
                        style="padding-bottom: 10px; color: #777777; font-family: Open Sans, Arial, sans-serif;">Yodlee
                        Sample Application</h2>
                </div>
            </div>
        </nav>
    </section>

    <div class="container" style="margin-top: 5%;">
        <div class="col-md-4 col-md-offset-4">
            <div class="panel panel-primary">
                <div class="panel-heading">Cobrand Login</div>
                <div class="panel-body">

                    <div class="row">
                        <div class="col-xs-12">
                            <div id="initCheck" class="alert alert-info">
                                <p>Initializing.....</p>
                                <p>Checking Cobrand Login Configurations</p>
                            </div>
                        </div>
                    </div>

                    <!-- Login Form -->

                    <!-- Username Field -->
                    <div class="row">
                        <div class="form-group col-xs-12">
                            <label for="username"><span class="text-danger"
                                style="margin-right: 5px;">*</span>Username:</label>
                            <div class="input-group">
                                <input class="form-control" id="username" type="text"
                                    name="username"  autofocus placeholder="Username" required /> <span
                                    class="input-group-btn"> <label class="btn btn-primary"><span
                                        class="glyphicon glyphicon-user" aria-hidden="true"></span></label>
                                </span>
                            </div>
                        </div>
                    </div>

                    <!-- Content Field -->
                    <div class="row">
                        <div class="form-group col-xs-12">
                            <label for="password"><span class="text-danger"
                                style="margin-right: 5px;">*</span>Password:</label>
                            <div class="input-group">
                                <input class="form-control" id="password" type="password"
                                    name="password" placeholder="Password" required /> <span
                                    class="input-group-btn"> <label class="btn btn-primary"><span
                                        class="glyphicon glyphicon-lock" aria-hidden="true"></span></label>
                                </span>
                            </div>
                        </div>
                    </div>

                    <!-- Login Button -->
                    <div class="row">
                        <div class="form-group col-xs-4">
                            <button id="submitButton" class="btn btn-primary" type="button" disabled="true" >Login</button>
                        </div>
                    </div>

                    <!-- End of Login Form -->

                </div>
            </div>
        </div>
    </div>

</body>

</html>

YodleeSampleApp1.1 的 config.properties 文件(已编辑联合品牌登录信息):

yodlee.APIURL=https://developer.api.yodlee.com/ysl/
##Set your cobrand name and api version to be passed in the HTTP Header request
yodlee.cobrandName=restserver
yodlee.apiVersion=1.1
##Set the cobrand login name and password from your Yodlee developer dashboard
yodlee.coBrandUserName=REDACTED
yodlee.coBrandPassword=REDACTED
##Set nodeUrl for FastLink app
yodlee.nodeUrl=https://node.developer.yodlee.com/authenticate/restserver/

有人知道我的设置有什么问题吗?是否有其他一些我忽略的安全功能使我的应用程序无法与外界通信?谢谢你的帮助!!

最佳答案

啊哈,我自己发现了这个问题。看起来 index.html 看起来像 YodleeSampleApp1.1/YodleeSampleApp 的 Java 文件,但是如果你的 WAR 像我的一样被命名为 'YodleeSampleApp1.1 (2).war',Tomcat 将把它解压为目录 'YodleeSampleApp1.1 (2) ' 和 index.html 将无法找到 Java 类。杜尔。

关于java - Yodlee 示例应用卡在 "Checking Cobrand Login Configurations";无法登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51530598/

相关文章:

java - 当 invokeAll() 的线程数少于任务数时会发生什么?

linux - httpd-2.4.10 从 "Regex could not be compiled"开始失败

tomcat - 如何为前端和后端 Web 服务器实现 robots.txt 文件?

java - Apache Tomcat 负载均衡集群

Java 数据库架构不存在 (netbeans 7)

java - 使用 Android 6.0(API LEVEL 23)消耗休息的最佳方式是什么

java - 如何分析 App Engine Java 上的实际内存使用情况?

Apache webserver - 当所有工作线程都忙时,请求会发生什么

apache - 使用 apache(Xampp) 在 PC 上托管网站

java - Tomcat 启动通过跳过扫描 jar 来加速,如果我跳过所有 jar,为什么没有抛出 ClassNotFound 异常?