My goal is:
I'm trying to set up Yodlee for an application that needs to be able to read my bank account information programatically.
My problem is:
I am able to build and deploy the YodleeSampleApp1.1.WAR as described in the Yodlee "Getting Started Guide" from https://developer.yodlee.com/API_Resources/Yodlee_Sample_App_Getting_Started_Guide. When I deploy the WAR file in a Tomcat 7 server on my windows machine, it works great, everything is perfect. But when I email the WAR to myself on my server and deploy it from the server, I can't log in to the app and it is stuck forever on "Checking Cobrand Login Configurations". I tried building the WAR on the server itself, but no difference and no dice.
My server's setup is as such:
I have a home server running Ubuntu 18.04 with Tomcat 9.0.10, behind Apache 2.4.29 using a Let's Encrypt certificate for HTTPS requests.
The Tomcat's server.xml is set up to only allow connections from 127.0.0.1, meaning hopefully that only Apache can connect to it, and then Apache is responsible for handling all HTTPS requests.
Ubuntu's UFW firewall is only open to incoming TCP protocol on ports 80 and 443 for Apache and TCP protocol on port 22 for SSH, outgoing requests are allowed by default.
My wireless router is set to forward ports on to my server machine, so that HTTP requests go to port 80 and HTTPS requests go to port 443 for Apache to receive them.
So far I have tried:
Documents are:
Tomcat's 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 "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
YodleeSampleApp1.1's 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's config.properties file (with cobrand login information redacted):
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/
Would anyone have any idea what is wrong with my setup? Is there some other security feature I am neglecting that is keeping my app from being able to communicate with the outside world? Thank you for the help!!
Ahhhh, I found the issue myself. Looks like index.html looks to YodleeSampleApp1.1/YodleeSampleApp for the Java file, but if your WAR is named 'YodleeSampleApp1.1 (2).war' like mine was, Tomcat will unpack it as directory 'YodleeSampleApp1.1 (2)' and index.html won't be able to find the Java class. Durrr.