<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog on Woolnough</title>
    <link>http://woolnough.com.au/blog/</link>
    <description>Recent content in Blog on Woolnough</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>Copyright (c) 2015, Matthew Woolnough; all rights reserved.</copyright>
    <lastBuildDate>Mon, 26 Oct 2015 00:00:00 +0000</lastBuildDate>
    <atom:link href="http://woolnough.com.au/blog/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>HTTP-Redirect disallowed for transport of SSO response</title>
      <link>http://woolnough.com.au/blog/http-redirect-disallowed-for-transport-of-sso-response/</link>
      <pubDate>Mon, 26 Oct 2015 00:00:00 +0000</pubDate>
      
      <guid>http://woolnough.com.au/blog/http-redirect-disallowed-for-transport-of-sso-response/</guid>
      <description>&lt;p&gt;This one is probably obvious to the initiated, but had me scratching my head for a little while, so I thought it worth posting.&lt;/p&gt;

&lt;p&gt;PingFederate when asked to perform an SP Initiated SSO Redirect-Redirect, fails with the following error in the logs.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;2015-10-23 16:38:20,404 tid:rBZwfgxQg49EnZYKgLARHbPCQak ERROR [org.sourceid.saml20.profiles.idp.HandleAuthnRequest] Exception occurred during request processing
org.sourceid.saml20.profiles.StatusResponseException: ProtocolBinding: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect disallowed for transport of SSO response.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This functionality has been intentionally excluded from the product according to the very helpful support engineer I spoke with at Ping.
The reasoning behind this is that the SAML response is typically quite long and whilst the HTTP/1.1 RFC states there is
   no limit to the length of a query string, there are practical limits implemented in browsers.  Testing all browsers
   for their limits is simply not practical.  Switching my app over to using SP Initiated SSO Redirect-POST resolved my issue.&lt;/p&gt;

&lt;p&gt;There&amp;rsquo;s some info on the query string limitations on &lt;a href=&#34;http://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string/812962#812962&#34;&gt;this&lt;/a&gt; (dated) stackoverflow answer&lt;/p&gt;

&lt;p&gt;The supported list of supported profiles that PingFederate supports (which I obviously didn&amp;rsquo;t check) is listed &lt;a href=&#34;https://documentation.pingidentity.com/pingfederate/pf80/index.shtml#gettingStartedGuide/concept/singleSignOn.html&#34;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the time of writing, this is the list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SP-Initiated SSO&amp;ndash;POST-POST&lt;/li&gt;
&lt;li&gt;SP-Initiated SSO&amp;ndash;Redirect-POST&lt;/li&gt;
&lt;li&gt;SP-Initiated SSO&amp;ndash;Artifact-POST&lt;/li&gt;
&lt;li&gt;SP-Initiated SSO&amp;ndash;POST-Artifact&lt;/li&gt;
&lt;li&gt;SP-Initiated SSO&amp;ndash;Redirect-Artifact&lt;/li&gt;
&lt;li&gt;SP-Initiated SSO&amp;ndash;Artifact-Artifact&lt;/li&gt;
&lt;li&gt;IdP-Initiated SSO&amp;ndash;POST&lt;/li&gt;
&lt;li&gt;IdP-Initiated SSO&amp;ndash;Artifact&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>PingFederate 8 and the JCE</title>
      <link>http://woolnough.com.au/blog/pingfederate-8-and-the-jce/</link>
      <pubDate>Sat, 10 Oct 2015 00:00:00 +0000</pubDate>
      
      <guid>http://woolnough.com.au/blog/pingfederate-8-and-the-jce/</guid>
      <description>

&lt;p&gt;TL;DR It&amp;rsquo;s a good idea to install JCE.&lt;/p&gt;

&lt;p&gt;Installing the Java Cryptography Extension &lt;a href=&#34;http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html&#34;&gt;JCE&lt;/a&gt; is highly recommended if your countries laws permit it&amp;rsquo;s importation and use, for two reasons: adherence with standards &amp;amp; interoperability.
There&amp;rsquo;s some pretty cool &lt;a href=&#34;http://hueniverse.com/2015/09/19/auth-to-see-the-wizard-or-i-wrote-an-oauth-replacement/&#34;&gt;stuff&lt;/a&gt; being developed by those who don&amp;rsquo;t care too much for interoperability, but for those of us in the Enterprise Identity Management space, it&amp;rsquo;s essential.&lt;/p&gt;

&lt;p&gt;Java 8 gives you basic crypto, but includes limits on &lt;a href=&#34;http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html&#34;&gt;Maximum Keysizes&lt;/a&gt;. The following table provides a quick summary.&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Algorithm&lt;/th&gt;
&lt;th&gt;Maximum Keysize&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DES&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;DESede (AKA TripleDES)&lt;/td&gt;
&lt;td&gt;*&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;RC2&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;RC4&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;RC5&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;RSA&lt;/td&gt;
&lt;td&gt;*&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;All others (inc. AES)&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;What does this mean for us?&lt;/p&gt;

&lt;h3 id=&#34;tls:e3af48ef36a0841a3da62d6f5a278b14&#34;&gt;TLS&lt;/h3&gt;

&lt;p&gt;Fewer Crypto options.
I don&amp;rsquo;t see this is a huge issue. When we deploy a PingFederate cluster, it&amp;rsquo;s typically behind a TLS Terminating Load Balancer anyway, which means that our TLS Sessions only exist in the data centre and we&amp;rsquo;re generally pretty happy with &lt;strong&gt;AES128&lt;/strong&gt; for TLS.&lt;/p&gt;

&lt;h3 id=&#34;saml-ws:e3af48ef36a0841a3da62d6f5a278b14&#34;&gt;SAML/WS-*&lt;/h3&gt;

&lt;p&gt;No &lt;strong&gt;TripleDES&lt;/strong&gt; or &lt;strong&gt;AES256&lt;/strong&gt; XML block encryption option&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not compliant with the &lt;a href=&#34;http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html&#34;&gt;W3C XML Encryption Recommendation&lt;/a&gt; (yes, only a recommendation) which is used by SAML &amp;amp; WS-* Protocols. This states that AES256 &amp;amp; TripleDES are &amp;lsquo;required&amp;rsquo;.&lt;/li&gt;
&lt;li&gt;Assertions in the responses are in the clear on the above mentioned Load Balancer (and many other similar scenarios) without this.  This may be an issue if the assertions contain sensitive information.&lt;/li&gt;
&lt;li&gt;We can&amp;rsquo;t be an Relying Party (RP) to an ADFS 2.x (and newer) Identity Provider (IP) without disabling the encryption of claims. &lt;code&gt;set-ADFSRelyingPartyTrust –TargetName &amp;quot;Ping RP&amp;quot; –EncryptClaims $False&lt;/code&gt;. It does not appear to be possible to downgrade ADFS to use AES128.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;openid-connect:e3af48ef36a0841a3da62d6f5a278b14&#34;&gt;OpenID Connect&lt;/h3&gt;

&lt;p&gt;The upcoming Javascript Object Signing and Encryption (JOSE) standard include a specification on &lt;a href=&#34;http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40#section-4.1&#34;&gt;JWE key management&lt;/a&gt; and &lt;a href=&#34;http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40#section-5.1&#34;&gt;JWE content encryption&lt;/a&gt;.
The table below shows the encryption and key management options with and without the JCE installed. Many of the additional options enabled by installing the JCE are either optional or recommended in the listed specifications.&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Config&lt;/th&gt;
&lt;th&gt;JWE content encryption algorithms&lt;/th&gt;
&lt;th&gt;JWE key management algorithms&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Without JCE&lt;/td&gt;
&lt;td&gt;A128CBC-HS256, A128GCM&lt;/td&gt;
&lt;td&gt;RSA1_5, RSA-OAEP, RSA-OAEP-256, dir, A128KW, ECDH-ES, ECDH-ES+A128KW, PBES2-HS256+A128KW, A128GCMKW&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;With JCE&lt;/td&gt;
&lt;td&gt;A128CBC-HS256, A192CBC-HS384, A256CBC-HS512, A128GCM, A192GCM, A256GCM&lt;/td&gt;
&lt;td&gt;RSA1_5, RSA-OAEP, RSA-OAEP-256, dir, A128KW, A192KW, A256KW, ECDH-ES, ECDH-ES+A128KW, ECDH-ES+A192KW, ECDH-ES+A256KW, PBES2-HS256+A128KW, PBES2-HS384+A192KW, PBES2-HS512+A256KW, A128GCMKW, A192GCMKW, A256GCMKW&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&#34;installation:e3af48ef36a0841a3da62d6f5a278b14&#34;&gt;Installation&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Ensure your JAVA_HOME is directed at your JRE, not the JDK.&lt;/li&gt;
&lt;li&gt;Download the &lt;a href=&#34;[JCE](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html&#34;&gt;Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Extract the files to JAVA_HOME\lib\security&lt;/li&gt;
&lt;li&gt;If you&amp;rsquo;re on a Windows OS, right click each policy file individually and unblock.&lt;/li&gt;
&lt;li&gt;Edit the following file and enable the ciphers you wish to use.
&lt;code&gt;&amp;lt;installDir&amp;gt;\pingfederate\server\default\data\config-store\com.pingidentity.crypto.SunJCEManager.xml&lt;/code&gt;&lt;br /&gt;
Note: If you want to be super cautious, disable &lt;strong&gt;TLS_DHE_RSA_WITH_AES_256_CBC_SHA256&lt;/strong&gt; and &lt;strong&gt;TLS_DHE_RSA_WITH_AES_256_CBC_SHA&lt;/strong&gt; as these are potentially susceptible to Logjam vulnerability. The Logjam test site reports that an uncommon 1024 bit group is used so it should be ok, but why risk it!?&lt;/li&gt;
&lt;li&gt;Restart the service&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If everything went successfully you should see messages in server.log resembling:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;org.jose4j.jwe.AesKeyWrapManagementAlgorithm$Aes256@7244d076 registered for alg algorithm A256KW&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;instead of:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A256KW is unavailable so will not be registered for alg algorithms.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you happen to notice the messages in the logs at startup stating that &lt;strong&gt;PS256&lt;/strong&gt;, &lt;strong&gt;PS384&lt;/strong&gt; &amp;amp; &lt;strong&gt;PS512&lt;/strong&gt; are unavailable, it&amp;rsquo;s safe to ignore these. They are unavoidable at the time of writing, as they require bouncy castle which is &lt;em&gt;not supported&lt;/em&gt; by PingFederate.&lt;/p&gt;

&lt;p&gt;Full log samples here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://gist.githubusercontent.com/mattwoolnough/5e77731b1696730137b0/raw/3146e8d74bb486ef4e0cb715942b09a2cc0966b1/server.log&#34;&gt;PingFederate Logs without JCE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://gist.githubusercontent.com/mattwoolnough/432f514e357aebcd7ccd/raw/bedf2a8af662d999df453edba931c3a031d679d0/server.log&#34;&gt;PingFederate Logs with JCE&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Creating a new publish settings file from azure portal</title>
      <link>http://woolnough.com.au/blog/creating-a-new-publish-settings-file-from-azure-portal/</link>
      <pubDate>Thu, 08 Oct 2015 00:00:00 +0000</pubDate>
      
      <guid>http://woolnough.com.au/blog/creating-a-new-publish-settings-file-from-azure-portal/</guid>
      <description>&lt;p&gt;With the introduction of Azure Resource Manager (ARM), it&amp;rsquo;s necessary to use &lt;a href=&#34;https://msdn.microsoft.com/en-us/library/dn495128.aspx&#34;&gt;Add-AzureAccount&lt;/a&gt; in many scenarios to get access to Azure using PowerShell. Sometimes you just need to quickly grab the publishsettings file however. I find it easiest to type the following into the browser:
&lt;a href=&#34;https://manage.windowsazure.com/publishsettings&#34;&gt;https://manage.windowsazure.com/publishsettings&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You will need to log into your Azure tenancy in the browser, if you are not already, but typically you&amp;rsquo;re already logged in and the publish settings file immediately downloads. This is especially helpful when you have multiple tenancies open in different browsers, like in the this previous code &lt;a href=&#34;http://woolnough.com.au/code/copying-drives-from-one-azure-subscription-to-another/&#34;&gt;post&lt;/a&gt;.
 Remember to be cautious with these publishsettings files, as they&amp;rsquo;re the keys to your kingdom whilst they&amp;rsquo;re active!&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://woolnough.com.au/media/2015-10-08 16_56_09-Downloading-the-publish-profile.png&#34; alt=&#34;Your subscription file is being generated, and the download will begin shortly Web Page&#34; /&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>PingFederate and Active Directory Kerberos Tokens</title>
      <link>http://woolnough.com.au/blog/pingfederate-and-ad-kerberos-tokens/</link>
      <pubDate>Thu, 10 Sep 2015 00:00:00 +0000</pubDate>
      
      <guid>http://woolnough.com.au/blog/pingfederate-and-ad-kerberos-tokens/</guid>
      <description>&lt;p&gt;An old AD issue that pops up from time to time is Kerberos Token Bloat. In a nutshell, the AD groups you&amp;rsquo;re a member of, the bigger your Kerberos Token. Eventually your token gets too big and stuff breaks.&lt;/p&gt;

&lt;p&gt;In the most common use case, when you attempt to access a web site, the Kerberos token is encoded and placed in the Authorization header of the Internet Explorer HTTP request.&lt;/p&gt;

&lt;p&gt;Servers receiving the HTTP request have a MaxTokenSize configured. Historically the MaxTokenSize was 12k. With Server 2012, this was bumped up to 48k - the maximum possible - constrained by HTTP Protocol. Some older documentation refers to a 65535 bytes, but this advice didn&amp;rsquo;t take into account that the kerberos token is Base64 encoded, which adds to the length of the token.&lt;/p&gt;

&lt;p&gt;PingFederate is configured to have a header size 8K. When integrating with a Kerberos Forest, We&amp;rsquo;re typically upping this to 48K, in line with Windows 2012+ .&lt;/p&gt;

&lt;p&gt;Ping offers some guidance on changing the size for the different versions &lt;a href=&#34;https://ping.force.com/Support/PingFederate/Integrations/IWA-Kerberos-authentication-may-fail-when-user-belongs-to-many-AD-groups&#34;&gt;here&lt;/a&gt;, but essentially for version 8, we want to make the following change in &lt;code&gt;&amp;lt;installdir&amp;gt;\pingfederate\bin\start.ini&lt;/code&gt;, to give it the same max size as server 2012.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-ini&#34;&gt;#jetty.request.header.size=8192
jetty.request.header.size=49152
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you&amp;rsquo;re curious about your own token size:
* On the desktop, use &lt;a href=&#34;http://www.microsoft.com/en-au/download/details.aspx?id=1448&#34;&gt;tokensz&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;C:\temp&amp;gt;tokensz.exe /compute_tokensize

Name: Kerberos Comment: Microsoft Kerberos V1.0
Current PackageInfo-&amp;gt;MaxToken: 48000

Using user to user
QueryKeyInfo:
Signature algorithm = HMAC-SHA1-96
Encrypt algorithm = Kerberos AES256-CTS-HMAC-SHA1-96
KeySize = 256
Flags = 2083e
Signature Algorithm = 16
Encrypt Algorithm = 18
   Start:9/22/2015 3:33:05
  Expiry:9/22/2015 12:31:44
Current Time: 9/22/2015 3:33:05
MaxToken (complete context)  6410

C:\temp&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;https://fullstackiam-ghost.s3.amazonaws.com/2015/Sep/fiddler-1442821722679.PNG&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the wire, use fiddler by adding a &lt;a href=&#34;http://docs.telerik.com/fiddler/Extend-Fiddler/AddRules&#34;&gt;custom rule&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code&gt;public  static  BindUIColumn(&amp;quot;Req-Header-Length&amp;quot;)
function  CalcMethodCol2(oS:  Session){
    if (null != oS.oRequest)
        return oS.oRequest.headers.ByteCount().ToString();
    else
        return String.Empty;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;public  static  BindUIColumn(&amp;quot;Resp-Header-Length&amp;quot;)
function  CalcMethodCol3(oS:  Session){
    if (null != oS.oResponse)
        return oS.oResponse.headers.ByteCount().ToString();
    else
        return String.Empty;
}
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>CasperJS testing PingFederate HTML form adapter</title>
      <link>http://woolnough.com.au/blog/casperjs-testing-pingfederate-html-form-adapter/</link>
      <pubDate>Wed, 19 Nov 2014 14:50:04 +1000</pubDate>
      
      <guid>http://woolnough.com.au/blog/casperjs-testing-pingfederate-html-form-adapter/</guid>
      <description>

&lt;p&gt;During a deployment of Ping Identity&amp;rsquo;s &lt;a href=&#34;https://www.pingidentity.com/en/products/pingfederate.html&#34;&gt;PingFederate&lt;/a&gt; product, we had a need to automate logging into the HTML Form Adapter.  Whilst there are many ways to automate this, I really liked this one, and thought it worth sharing.&lt;/p&gt;

&lt;p&gt;The solution has 2 components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://phantomjs.org&#34;&gt;PhantomJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://casperjs.org&#34;&gt;CasperJS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&#34;phantomjs:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;PhantomJS&lt;/h1&gt;

&lt;p&gt;PhantomJS is a headless browser this uses the WebKit browser by default, but can also use the Gecko engine courtesy of SlimerJS.&lt;/p&gt;

&lt;h1 id=&#34;casperjs:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;CasperJS&lt;/h1&gt;

&lt;p&gt;CasperJS started life as a bunch of scripts which drove PhantomJS &amp;amp; has since evolved into a full framework. This code utilizes version 1.1 of CasperJS, which despite being a development version is quite stable and is in fact the version the maintainers of CasperJS recommend.&lt;/p&gt;

&lt;h2 id=&#34;installation:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;Installation&lt;/h2&gt;

&lt;h3 id=&#34;windows:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;Windows&lt;/h3&gt;

&lt;p&gt;Download phantomjs: &lt;a href=&#34;http://phantomjs.org/download.html&#34;&gt;http://phantomjs.org/download.html&lt;/a&gt;
Unzip it to C:\phantomjs&lt;/p&gt;

&lt;p&gt;Download the latest zip from this page: &lt;a href=&#34;http://docs.casperjs.org/en/latest/installation.html&#34;&gt;http://docs.casperjs.org/en/latest/installation.html&lt;/a&gt; and unzip to a safe &amp;amp; sensible location like C:\casperjs&lt;/p&gt;

&lt;p&gt;Modify the PATH variable to make the binary accessible&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;setx PATH &amp;quot;%PATH%;C:\phantomjs\;C:\casperjs\bin&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;linux:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;Linux&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;$ wget https://phantomjs.googlecode.com/files/phantomjs-1.9.8-linux-x86_64.tar.bz2
$ tar xvjf phantomjs-1.9.8-linux-x86_64.tar.bz2
$ cd phantomjs-1.9.8-linux-x86_64
$ sudo ln -sf &amp;quot;$(pwd)&amp;quot;/bin/phantomjs /usr/local/bin/phantomjs
$ cd ..
$ git clone git://github.com/n1k0/casperjs.git
$ cd casperjs
$ sudo ln -sf &amp;quot;$(pwd)&amp;quot;/bin/casperjs /usr/local/bin/casperjs
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;mac:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;Mac&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;brew update &amp;amp;&amp;amp; brew install phantomjs
brew install casperjs --devel
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;configuration:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;Configuration&lt;/h1&gt;

&lt;p&gt;The configuration required is minimal.&lt;/p&gt;

&lt;p&gt;PhantomJS by default utilizes SSLv3, so if you encounter the following warning and the script continually fails to complete:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-language-bash&#34;&gt;[warning] [phantom] Loading resource failed with status=fail: https://fed.companyb.com/idp/prp.wsf?wa=wsignin1.0&amp;amp;wtrealm=https://applicationa.companyb.com/&amp;amp;wfresh=15&amp;amp;wctx=rm=0&amp;amp;id=passive&amp;amp;ru=%2fCIS%2f&amp;amp;wct=2014-11-19T05:34:06Z
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The solution is to enable TLS using one of the following methods:&lt;/p&gt;

&lt;p&gt;1) Specify the protocol to use each time you execute casperjs:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;casperjs --ssl-protocol=tlsv1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2) Or, edit the file C:\casperjs\bin\casperjs and add the above switch to the ENGINE_ARGS&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ENGINE_ARGS = [&#39;ssl-protocol=tlsv1&#39;]&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&#34;solution-code:0b8a11de59b185de606bc0cf3613b22a&#34;&gt;Solution code&lt;/h1&gt;

&lt;pre&gt;&lt;code class=&#34;language-javascript&#34;&gt;&amp;quot;use strict&amp;quot;;
 
var  url = &#39;https://applicationa.companyb.com/&#39;,
username = &#39;mattheww&#39;,
password = &#39;password&#39;,
   debug = true,
logLevel = null;
  
if (debug) {
  logLevel = &#39;debug&#39;;
} else {
  logLevel = &#39;info&#39;;
}
 
var casper = require(&#39;casper&#39;).create({
  pageSettings: {
    loadImages:  false,   // The WebPage instance used by Casper will
    loadPlugins: false,   // use these settings
    userAgent: &#39;Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36&#39;
  },
    logLevel: logLevel,   // debug; info; warning; error
    verbose: true,        // log messages will be printed out to the console
    options: {
      waitTimeout: 25000, // Timeout of 25 sec
    }
});

casper.start(url, function () {
  this.log(&#39;Attempting login to &#39; + url, &#39;info&#39;);
  this.fill(&#39;form&#39;, {
    &#39;pf.username&#39;: username,
    &#39;pf.pass&#39;: password
  }, true);
});

casper.then(function() {
  var currentURL = this.getCurrentUrl();
  if (currentURL === url) {
    console.log(&amp;quot;SUCCESS!: We&#39;re in &amp;quot; + currentURL);
  } else if (/prp.ping$/i.test(currentURL)) {
    console.log(&amp;quot;FAIL!: We&#39;re stuck on prp.ping&amp;quot;);
      if (debug) {
        // Dump whole page for visual inspection
        var page = this.evaluate(function() {
                       return document;
        });
        this.echo(page.all[0].outerHTML);
      } else {
        if (this.exists(&#39;div.ping-body form div div&#39;)) {
          var msg = this.fetchText(&#39;div.ping-body form div div&#39;);
          var msgArray = msg.split(&#39;\t&#39;);
          this.echo(msgArray[0]);
        } else if (this.exists(&#39;div.ping-body&#39;)) {
          var pingBody = this.fetchText(&#39;div.ping-body&#39;);
          if (pingBody.indexOf(&#39;Access denied (403)&#39;) &amp;gt;= 0 ) {
            this.echo(pingBody);
          }
        }
      }
  }
});
 
casper.run();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When successful,the output should resemble below&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;C:\casperjs\bin&amp;gt;casperjs.exe ..\mw\run.js
[info] [phantom] Starting...
[info] [phantom] Running suite: 3 steps
[info] [phantom] Step anonymous 2/3 https://fed.companyb.com/idp/ZVlk9/resume/idp/prp.ping (HTTP 200)
[info] [phantom] Attempting login to https://applicationa.companyb.com/
[info] [remote] attempting to fetch form element from selector: &#39;form&#39;
[info] [remote] submitting form to /idp/ZVlk9/resume/idp/prp.ping, HTTP POST
[info] [phantom] Step anonymous 2/3: done in 154ms.
[info] [phantom] Step anonymous 3/3 https://applicationa.companyb.com/ (HTTP 200)
SUCCESS!: We&#39;re in https://applicationa.companyb.com/
[info] [phantom] Step anonymous 3/3: done in 730ms.
[info] [phantom] Done 3 steps in 749ms
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A failure will resemble the following:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;C:\casperjs\bin&amp;gt;casperjs ..\mw\run.js 
[info] [phantom] Starting...
[info] [phantom] Running suite: 3 steps
[info] [phantom] Step anonymous 2/3 https://fed.companyb.com/idp/82l2u/resume/idp/prp.ping (HTTP 200)
[info] [phantom] Attempting login to https://applicationa.companyb.com/
[info] [remote] attempting to fetch form element from selector: &#39;form&#39;
[info] [remote] submitting form to /idp/82l2u/resume/idp/prp.ping, HTTP POST
[info] [phantom] Step anonymous 2/3: done in 163ms.
[info] [phantom] Step anonymous 3/3 https://fed.companyb.com/idp/82l2u/resume/idp/prp.ping (HTTP 200)
FAIL!: We&#39;re stuck on prp.ping
Authentication failed. You have used an invalid username and/or password.
[info] [phantom] Step anonymous 3/3: done in 469ms.
[info] [phantom] Done 3 steps in 485ms
 
C:\casperjs\bin&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
  </channel>
</rss>