Skip to main content

OAuth-erize The Nation! With OpenIG 3.0

OpenIG 3.0 was released a couple of weeks ago, with some significant enhancements.  One of which was the ability to protect applications through the use OAuth2 access tokens, with very little effort.

OAuth2 has been around for a while, and provides a lightweight and developer friendly way to leverage authorization services for web and native applications.  To utilise the features of OAuth2 such as access token validation, refresh token to access token exchange and then scope querying by the client application, generally requires code changes within both the client app and resource servers.  This isn't necessarily a bad thing nor particularly complex, but in some circumstances,  you may not have access to the underlying code, or perhaps the app is hosted by a 3rd party.

OpenIG, as it's a reverse proxy, can easily sit in between the user community and the underlying target application.  With a simple edit of a JSON file, OpenIG can be setup to act as both the resource server and client in an OAuth2 or OpenID Connect environment.

The installation of OpenIG is trivial. A simple Java web application that can be dropped into either a Tomcat or Jetty container.  The app bootstraps from a locally stored configuration folder.  A standard config.json file should be created in the ~/.openig/config/ directory (or equivalent home directory on Windows).  This file contains the entire setup for IG, with things such as handlers, chains and clients, that perform the necessary request checking, stripping or parsing of attributes and replay into the target applications.  Of course, one of the benefits of OpenIG, is that itself, can indeed be protected by an OpenAM policy agent, and utilise any attributes that can be passed downstream to IG.

Following the simple example that comes with the OpenIG documentation, setting up integration a an OIDC relying party is pretty quick.  OpenAM can quickly be configured as the OAuth2 provider, as this functionality is available out of the box and configurable via one of the OpenAM Common Tasks wizard.

The example configuration for setting up IG as an OAuth2 client basically has two main components - an overall handler object (OpenIDConnectChain) that initiates the interaction to the OAuth2 provider and an out going handler, that retrieves the necessary attributes from the OIDC scope, and replays them into the target application as the necessary username and password.  There's also a capture filter for logging.  In production, you perhaps wouldn't necessarily replay the password here, but it would depend on the underlying application.

The OpenIDConnectChain, contains an OAuth2ClientFilter object conveniently called OpenIDConnectClient!  This object, contains the necessary OAuth2 provider details - URL, clientID, requested scopes and so on.  The information retrieved by the request is actually stored in the target attribute - ${exchange.openid}.  This attribute can then be queried by the out going chain, namely the GetCredentials object, which is a Groovy scriptable component.  Being scriptable, means we are pretty free to extend this as we see fit.  In this example, the GetCredentials object, simply pulls out the username and password fields.  Those fields are then passed down to the LoginRequestFilter object, which replays the fields into a form in the protected application.

Mega simple!  The beauty of it, is that underlying application (in this case the Java sample HTTP that comes with the OpenIG document)  requires zero code changes. All of the configuration is abstracted into the OpenIG proxy.

The same process can easily be repeated for other federation protocols such as SAML2.


Popular posts from this blog

WebAuthn Authentication in AM 6.5

ForgeRock AccessManagement 6.5 , will have out of the box integration for the W3C WebAuthn . This modern “FIDO2” standard allows cryptographic passwordless authentication – integrating with a range of native authenticators, from USB keys to fingerprint and facial recognition systems found natively in many mobile and desktop operating systems. Why is this so cool? Well firstly we know passwords are insecure and deliver a poor user experience. But aren’t there loads of strong MFA solutions out there already? Well, there are, but many are proprietary, require complex integrations and SDK’s and ultimately, don’t provide the level of agility that many CISO’s and application designers now require.  Rolling out a secure authentication system today, will probably only result in further integration costs and headaches tomorrow, when the next “cool” login method emerges. Having a standards based approach, allows for easier inter-operability and a more agile platform for chan

Implementing Zero Trust & CARTA within AM 6.x

There is an increasing focus on perimeterless approaches to security design and the buzzy "defensive security architectures".  This blog will take a brief look at implementing a contextual and continuous approach to access management, that can help to fulfil those design aspirations. The main concept, is to basically collect some sort of contextual data at login time, and again at resource access time - and basically look for differences between the two.  But why is this remotely interesting?  Firstly, big walls, don't necessarily mean safer houses.  The classic firewall approach to security.  Keeping the bad out and the good in.  That concept no longer works for the large modern enterprise.  The good and bad are everywhere and access control decisions should really be based on data above and beyond that directly related to the user identity, with enforcement as close as possible to the protected resource as possible. With Intelligent AuthX, we can start to collect an

Set Session Limits Using Context

Session limits typically cover 4 main items: total number of sessions a user can have at any one time, the max length of each session, the max idle time and max caching time. In an out of the box deployment in ForgeRock AM, these settings are configured via the session service.  However there are few tweaks than can be made to allow these settings to be run via a per user or per tree flow.  For example. think of the following scenario - user is logging via a device, location or network that has a higher risk rating.   Perhaps you would like to reduce session length on a BYOD device running an out of support version of Android to have a length of only 15 minutes.  If they switched back to their main trusted device, we can spin that back to 1hr. Another example, could be the spotting of a higher suspicion of bot activity for a particular user.  Maybe we need to set the entire quota limit to 1, to stop a bot spawning multiple sessions with the same credentials. This is all pretty trivial