AM Integration With Headers
This template route logs the user into the target application by using headers such as those passed in from an AM policy agent. If the passed in header contains only a user name or subject and requires a lookup to an external data source, you must add an attribute filter to the chain to retrieve the credentials.
{ "heap": [ { "name": "ReverseProxyHandler", "type": "ReverseProxyHandler", "comment": "Testing only: blindly trust the server cert for HTTPS.", "config": { "tls": { "type": "ClientTlsOptions", "config": { "trustManager": { "type": "TrustAllManager" } } }, "hostnameVerifier": "ALLOW_ALL" } } ], "handler": { "type": "Chain", "config": { "filters": [ { "type": "PasswordReplayFilter", "config": { "loginPage": "${request.uri.path == '/login'}", "request": { "method": "POST", "uri": "https://app.example.com:8444/login", "form": { "username": [ "${request.headers['username'][0]}" ], "password": [ "${request.headers['password'][0]}" ] } } } } ], "handler": "ReverseProxyHandler" } }, "condition": "${matches(request.uri.query, 'demo=headers')}" }
To try this example with the sample application:
Add the route to IG:
$HOME/.openig/config/routes/26-headers.json
%appdata%\OpenIG\config\routes\26-headers.json
Use the curl command to simulate the headers being passed in from an AM policy agent, as in the following example:
$
curl \ --header "username: kvaughan" \ --header "password: B5ibery12" \ http://openig.example.com:8080/login?demo=headers
... <title id="welcome">Howdy, kvaughan</title> ...
To use this as a default route with a real application:
Replace the test ReverseProxyHandler with one that is configured to trust the application's public key server certificate. Otherwise, use a ReverseProxyHandler that references a truststore holding the certificate.
Configure the ReverseProxyHandler to strictly verifiy hostnames for outgoing SSL connections.
In production, do not use
TrustAllManager
for TrustManager, orALLOW_ALL
for hostname verification. For information, see "ReverseProxyHandler".Change the
loginPage
,uri
, andform
to match the target application.Remove the route-level condition on the handler that specifies a
demo
query string parameter.