OpenIG 3.1.0 released

openig-logo This past Friday ForgeRock released OpenIG 3.1.0, an official minor release for which you can get support from ForgeRock. You can download OpenIG 3.1.0 from http://forgerock.com/download-stack/.

OpenIG is a reverse proxy with session management and credential replay functionality. It runs as a web application in Apache Tomcat or Jetty. By using OpenIG you can provide identity and access management solutions for just about any web application, and you can do it without touching the web application itself. OpenIG supports standards like OAuth 2.0, OpenID Connect 1.0, and SAML 2.0, and of course integrates well with ForgeRock’s software stack. Furthermore, OpenIG is extensible through built-in Groovy support and Java plugin points.

As a minor release, OpenIG 3.1.0 is backward compatible with 3.0.0 so you can try it with your existing configuration.

You can then start to take advantage of new features:

  • A JWT session implementation lets you store all state on the client side as long as it fits in a browser cookie whose value is the session data in an encrypted JWT. OpenIG holds the keys for encryption and decryption to prevent anyone else from accessing the session data. By delegating storage of all state data to the user-agent, you can scale out your deployment without having to configure OpenIG’s container to share session data.
  • Inline configuration objects and other improvements make OpenIG configuration files easier to read.
  • Configuration object decorators make it straightforward to capture requests, responses, and exchange data, to time operations, and to audit OpenIG operations.
  • A publish-and-subscribe audit framework and sample monitoring handler returns basic statistics about OpenIG operations.
  • Other improvements make console logs easier to read, script parameters easier to set, OAuth 2.0/OpenID Connect filters more performant, and client information easier to discover.

Start with the Release Notes for details. Full documentation is available on docs.forgerock.org. Also check out the articles written by Ludo and Guillaume.

When you have questions, in addition to the mailing list ForgeRock also now provides an OpenIG Forum. Stop by to let us know what you think of OpenIG 3.1.0.

Leave a comment

Filed under Access Management

OpenAM: REST APIs for policy evaluation

OpenAM logo

One of the significant new features added to OpenAM and coming in the pending release is the new REST API for policy evaluation. To try the API, get a nightly build of OpenAM, or build the code yourself from the trunk.

Some background: Your application should not be in the business of making policy decisions. Not because you are not smart enough to do it, but instead because you do not want to maintain potentially intricate and changing policies across all your applications. Instead your application should ask a service like OpenAM to make policy decisions, and then focus only on enforcing those policy decisions. (In fact, if your application runs in a web server or application server, you could do even better by getting a policy agent to do the work on your application’s behalf.) You can therefore administer policies within the service like OpenAM, and have them uniformly enforced across many applications. Policy evaluation is what your application asks a policy decision point like OpenAM to carry out.

OpenAM has had REST APIs for policy evaluation for a long time. The older APIs required, however, that you re-encode the SSO token in a particular way. They also did not necessarily return JSON, making them a bit more difficult to work with.

The newer API returns JSON, and does not require tokens to be re-encoded. The newer API makes use of two endpoints:

  1. /json/policies?_action=evaluate (for myRealm/subRealm, /json/myRealm/subRealm/policies?_action=evaluate)
    This endpoint takes an HTTP POST, where the POST data is a JSON object defining the “resources”, “application”, “subject”, and “environment” for which OpenAM makes the policy decision.

    • The “resources” in this case is an array of strings specifying the resource(s), such as "http://www.example.com/profile", that the user is trying to access. This is the only required field.
    • The “application” is the policy application name. You see the application names in the new policy editor. Policies belong to applications, so the application name narrows down the set of policies that can apply.
    • The “subject” can take an SSO token ID string to represent the subject, but it can also take a JWT or a map of JWT claims, depending on how the policies are configured in OpenAM.
    • The optional “environment” can provide additional information about the environment of the user who is trying to access the resource.
  2. /json/policies?_action=evaluateTree (for myRealm/subRealm, /json/myRealm/subRealm/policies?_action=evaluateTree)
    This endpoint takes an HTTP POST with POST data similar to the first. Instead of “resources”, it takes a “resource” string. OpenAM returns policy decisions about all the resources under the specified “resource”.

Suppose you have a policy in OpenAM that belongs to the default application and that allows authenticated users GET access to "http://www.example.com/profile", returning the user’s common name as a response attribute.

In addition, you have a web page that allows you to get a policy decision when logged in as a user authorized to request policy decisions, such as OpenAM administrator. (This example is overly simplistic and mixes up content with policy enforcement. In real life, your client-side JavaScript would end up requesting a resource; your server-side policy enforcement code would check with OpenAM before responding.)

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>

<h3>Fake Profile Page</h3>

<div id="common-name"></div>
<div id="policy-decision"></div>
<div id="error"></div>

<script type="text/javascript">

var endpoint  =
  "http://openam.example.com:8080/openam/json/policies?_action=evaluate";
var resources =
  '{ "resources": [ "http://www.example.com/profile" ] }';

$(document).ready(function () {

  // Request decision from OpenAM.
  $.ajax({

    url: endpoint,
    type: "POST",
    contentType: "application/json",
    dataType: "json",
    data: resources

  }).done(function (data) {

    // Display the name.
    $("#common-name").html(
      "<h4>Common Name</h4>"
      + "<pre>"
      + data[0].attributes.cn
      + "</pre>"
    );

    // Display the full response.
    $("#policy-decision").html(
      "<h4>Policy Decision</h4>"
      + "<pre>"
      + JSON.stringify(data, undefined, 2)
      + "</pre>"
    );

  }).fail(function (data) {

    // Display the error response.
    $("#error").html(
      "<h4>Error:</h4>"
      + "<pre>"
      + JSON.stringify(data, undefined, 2)
      + "</pre>"
      );
    });
});

</script>

</body>
</html>

If you first login to OpenAM as amadmin in order to get a session cookie and then visit the web page, you can get a policy decision for the specified resource.

policy

For details on the API, see the draft documentation on Requesting Policy Decisions.

Leave a comment

Filed under Access Management

OpenIG: A new audit framework

openig-logo This past week Guillaume added an audit framework to OpenIG. You can try it out by installing a new nightly build of OpenIG.

The audit framework follows a publish-subscribe pattern. You add “audit” decorations to OpenIG filter, handlers, and routes. The decorated objects trigger publication of audit events.

Each audit event holds a pointer to the exchange, the name of the object that triggered the event, a timestamp, and tags for the event. OpenIG provides built-in tags: a request when the object is first called; a response after the object is called; a completed tag on success; an exception tag on error. Audit agents subscribe to the audit events, and can select the audit events they want based on the tags. When you set “audit” decorations, you can define your own tags, too, such as “raise alarm” or “Default route”.

If your default route for example looks like this today:

{
  "handler": "ClientHandler"
}

Then you can update the route for audit like this:

{
  "handler": "ClientHandler",
  "audit": "default route"
}

OpenIG currently provides one audit agent out of the box: MonitorEndpointHandler. A MonitorEndpointHandler counts how many messages through the object are “active”, “completed”, or “failed”, sorts them by the tags used, and returns the result as JSON. You can set a monitor route up like this:

{
  "handler": {
    "type": "MonitorEndpointHandler"
  },
  "condition": "${exchange.request.method == 'GET'
      and exchange.request.uri.path == '/monitor'}",
  "audit": "monitor"
}

Suppose that your top level config.json file looks like this:

{
  "handler": {
    "type": "Router",
    "audit": "main"
  },
  "heap": [
        {
            "name": "LogSink",
            "type": "ConsoleLogSink",
            "config": {
                "level": "DEBUG"
            }
        },
        {
            "name": "ClientHandler",
            "type": "ClientHandler"
        },
        {
          "name": "capture",
          "type": "CaptureDecorator",
          "config": {
            "_captureEntity": true,
            "_captureExchange": true
          }
        }
    ],
    "baseURI": "http://www.example.com:8081"
}

Furthermore, suppose you have the default route shown above, plus another route that looks like this:

{
  "handler": {
    "type": "StaticResponseHandler",
    "config": {
      "status": 200,
      "reason": "OK",
      "entity": "Hello from a static route"
    }
  },
  "condition":
      "${matches(exchange.request.uri.path, '^/static')}",
  "audit": "static route"
}

After you access your routes through OpenIG a few times, you can see the monitoring results by accessing the /monitor endpoint, which returns the statistics in JSON:

{
    "static route": {
        "active": 0,
        "completed": 22,
        "failed": 0
    },
    "main": {
        "active": 1,
        "completed": 36,
        "failed": 0
    },
    "monitor": {
        "active": 1,
        "completed": 0,
        "failed": 0
    },
    "default route": {
        "active": 0,
        "completed": 14,
        "failed": 0
    }
}

Notice that “main” shows the sum for all exchanges, “static route” shows 22 successful exchanges, “default route” 14, and “monitor” (monitoring itself) has 1 active exchange in progress, the current one.

For more on auditing in OpenIG, start with the draft chapter, OpenIG Audit Framework.

Leave a comment

Filed under Access Management

OpenIG’s improved configuration files, part II

openig-logoGuillaume, Matt, and Violette’s recent work has made OpenIG configuration a lot easier to read and write. To try this at home, grab the latest nightly build of OpenIG. (The changes in the server are backwards compatible, too, so you don’t have to move right away. But you will want to.)

Imagine that you are working with OpenIG 3.0.0, debugging one of your basic routes. You want to capture requests and responses going through your route to see what is going on. Your route definition looks something like this:

{
    "heap": {
        "objects": [
            {
                "name": "LoginChain",
                "type": "Chain",
                "config": {
                    "filters": [
                        "CaptureFilter",
                        "LoginRequest"
                    ],
                    "handler": "ClientHandler"
                }
            },
            {
                "name": "CaptureFilter",
                "type": "CaptureFilter",
                "config": {
                    "file": "/tmp/gateway.log"
                }
            },
            {
                "name": "LoginRequest",
                "type": "StaticRequestFilter",
                "config": {
                    "method": "POST",
                    "uri": "http://www.example.com",
                    "form": {
                        "username": [
                            "george"
                        ],
                        "password": [
                            "costanza"
                        ]
                    }
                }
            },
            {
                "name": "ClientHandler",
                "type": "ClientHandler",
                "config": {}
            }
        ]
    },
    "handler": "LoginChain"
}

Fast forward to last night’s build of OpenIG, taking into account Guillaume’s inlining and capture decorator, Violette’s removal of empty “config” settings, Matt’s streamlining of the “heap” when not necessary and updates to the way decorations can be done.

Here is that same route, seriously improved.

{
    "handler": {
        "type": "Chain",
        "config": {
            "filters": [
                {
                    "type": "StaticRequestFilter",
                    "config": {
                        "method": "POST",
                        "uri": "http://www.example.com",
                        "form": {
                            "username": [
                                "george"
                            ],
                            "password": [
                                "costanza"
                            ]
                        }
                    }
                }
            ],
            "handler": {
                "type": "ClientHandler"
            }
        }
    },
    "capture": "all"
}

Well, almost the same route. You now capture requests and responses at many more points in the flow.

Notice that the very first thing in the configuration is the “handler” that produces a response.

The “Chain” is much easier to read, too.

When you start writing scripts or get stuck with a complex configuration, add a “CaptureDecorator” definition with "captureExchange": true for even more debugging information at each capture point.

You can now go utterly minimalist in your default route, assuming you define a “ClientHandler” in the top-level config.json file.

{ "handler": "ClientHandler" }

For more on what’s happening in the configuration and around OpenIG, see the draft, in-progress What’s New chapter of the release notes.

1 Comment

Filed under Access Management

OpenIDM: Trying the new Admin UI

openidm-logo One of the cool features in the upcoming release of OpenIDM is the new Admin UI. Jake Feasel demonstrated this to several people last week. It already looks like a major improvement for newbies over editing configuration files.

If like me you have been out of the loop for a while, it is reassuring to see that OpenIDM still installs a dream when you are just getting started. Download, unzip, and ./startup.sh.

Here is how you might start OpenIDM with an existing sample. This uses sample2, which is one-way synchronization with OpenDJ. You are not required to start with the samples, but they can quickly bootstrap your evaluation, without requiring you to read much doc or to think through the initial configuration.

$ cd /path/to && mv ~/Downloads/openidm . && cd openidm
$ ./startup.sh -p samples/sample2
Executing ./startup.sh...
Using OPENIDM_HOME:   /path/to/openidm
Using PROJECT_HOME:   /path/to/openidm/samples/sample2
Using OPENIDM_OPTS:   -Xmx1024m -Xms1024m
Using LOGGING_CONFIG: -Djava.util.logging.config.file=/path/to/openidm/samples/sample2/conf/logging.properties
Using boot properties at /path/to/openidm/samples/sample2/conf/boot/boot.properties
OpenIDM version "3.1.0-RC3-SNAPSHOT" (revision: 4297) jenkins-OpenIDM-3746 null
-> OpenIDM ready

OpenIDM’s web based UI is ready for HTTPS out of the box, but it seems you can still use HTTP for evaluation.

For example, you can visit http://localhost:8080/openidmui/ and login as openidm-admin:openidm-admin.

OpenIDM’s UI helps prevent default passwords by prompting you to change your password the first time you login.

openidm-first-login

You find the Admin UI at http://localhost:8080/admin/. This shows the view when running with the sample2 configuration.

openidm-admin-home

The new Admin UI offers a wizard-like approach to setting up provisioning. If you follow sample2, set up OpenDJ with some sample data before you get started. The sample comes with a mapping from OpenDJ accounts to managed/user.

openidm-add-properties

The sample also comes with a configuration for what to do in different situations during synchronization. Most of the policies are defaults.

openidm-sync-config

To run reconciliation and synchronize your source and target, either click the Reconcile Now or schedule reconciliation on the Sync Tab of the Mappings page. When reconciliation completes, you should have a bunch of new managed users. If you schedule reconciliation, subsequent runs might not encounter any changes.

openidm-recon

Click the User View link at the upper left of the page and then the Users tab to view all your managed users.

openidm-users-list

When you change a mapped attribute in the source, in this case OpenDJ, reconciliation updates it in the target, in this case the managed/user. For example, Babs Jensen’s original mail address is bjensen@example.com.

openidm-babs-before

After changing the mail address in OpenDJ to babs.jensen@example.com, reconciliation updates her corresponding managed/user in OpenIDM’s repo. Refreshing the page after reconciliation, you can see the change.

openidm-babs-after

The OpenIDM Admin UI is quite a leap forward, and promises to make it much easier for all of us to create and edit resources and mappings, and to arrange and schedule synchronization. Hats off to the OpenIDM team!

2 Comments

Filed under Identity Management

OpenAM: Policy management improvements

OpenAM logoLast week’s entry summarized new OAuth 2.0 and OpenID Connect related features that you can try in the nightly builds of OpenAM. But those aren’t the only important changes for the next major release. Among the many others are changes to policy management, including a slick new UI for creating and editing policies.

Rest assured that your existing agents and existing policies still work fine after you upgrade your OpenAM servers. Policy evaluation works as it did before. What’s been done is to take full advantage of the newer policy engine implementation that is already in use today behind the scenes, but not made visible in OpenAM 11.

The new policy editor (re)introduces the notion of application. An application serves as a template for policies, and helps you to group policies. When you open the policy editor in OpenAM console, the first thing you see is the list of applications for the realm where you are managing policies. The default application in the top-level realm, geared for web and Java EE policy agents, is named (with a bit of nostalgia for the old folks) iPlanetAMWebAgentService.

PolicyEditor

You can then drill down to create or edit a policy that belongs to this application.

PolicyEditorApplication

Notice the policy for the OAuth 2.0 authorization server & OpenID Provider. It is when you start creating or editing the policies that you see the strongest features of the new UI.

PolicyEditorPolicy

As you see in this excerpt (conditions and response attributes are not shown), the policy editor works like a wizard, guiding you through the steps to build your policy. You can build up subject and environment conditions using the logical operations. The image shows a subject condition for all authenticated users but not the demo user.

One thing to keep in mind if when creating your own applications, especially in sub-realms: OpenAM can now direct policy agents straight to an application, so you don’t always need referrals (unless for example you want to have a policy agent protecting multiple applications). This is done with a couple of new properties in the policy agent profile. Here’s a snapshot of the Policy Client Service section of a web policy agent profile screen showing the new properties.

PolicyClientService

These properties are not actually used by the policy agent, but instead by OpenAM, when it directs policy decision requests to the right realm and application.

Underlying the new UI is a full REST API for policy management and policy evaluation. The REST API opens up additional application types, letting you describe applications where the verbs are not necessarily those of HTTP, and write custom policy enforcement points for such applications.

There are still a few changes forthcoming in the UI, and the documentation is catching up with the code, but this is something you can start playing with already in the latest builds.

Leave a comment

Filed under Access Management

OpenAM: More OAuth 2/OpenID Connect features

OpenAM LogoIf you have not looked at OpenAM development in a while, you might have missed some of the new capabilities now in the nightly builds and coming in the next release. Many areas from STS to policy to REST APIs are involved.

One specific area centers on OAuth 2/OpenID Connect and mobile-oriented deployments.

OpenAM nightly builds now support:

  • GSMA Mobile Connect, especially the OpenID Connect 1.0 profile
    Mobile Connect lets users authenticate with their mobile phones, regardless of the service or the device on which it is consumed, so that Mobile Network Operators can serve as identity providers for their customers. As OpenAM has authenticators needed for GSMA Mobile Connect out of the box, and also has an authentication module SPI, OpenAM can play both the OP and authenticator roles in a Mobile Connect deployment.
    Check out this sample JavaScript client on GitHub for a non-secure but transparent look at how service using Mobile Connect client might work with OpenAM. Also read Using OpenAM with Mobile Connect.
  • Easily setting up OpenAM as a client of an OpenID Provider or an OAuth 2.0 authorization server
    When you first login as OpenAM administrator, there it is on the common tasks page: Configure Social Authentication.
    This makes it a snap to use Facebook, Google, MSN, or another provider as an identity provider for your users, and still protect resources with OpenAM.
  • OpenID Relying Parties registering without first obtaining an access token
    If you can throttle requests, this can streamline registration of OpenID RPs quite a bit. See To Register a Relying Party Dynamically.
  • Self-service management of OAuth 2.0 tokens
    This console feature lets users revoke authorization for applications. Even if you implement a feature like this elsewhere, it can be handy for testing. See User Consent Management.
  • Users authenticating with an OpenID Provider’s ID token
    OpenAM provides an OpenID Connect authentication module for this. See Hints for the OpenID Connect id_token bearer Module.
  • OAuth 2.0 scopes as conditions for OpenAM policies
  • CORS for OpenAM APIs
    Cross-Origin Resource Sharing makes it easier to use all the REST APIs in user-agent based applications. See Enabling CORS Support.
  • JWTs for authentication, and JWTs or SAML assertions to request access tokens
    Check out this sample Java client on GitHub for an example of how to request an access token with client-built JWT.
    The JWT bearer profile support can be handy for example with service accounts where there’s no end user involved. The documentation for this is in review.
    The SAML assertion bearer profile can be useful when integrating OAuth 2.0/OpenID Connect in a deployment that can already do SAML 2.0 federation. See SAML 2.0 Bearer Assertion Profiles.

As always, your input for the documentation on these topics is welcome. At the bottom of the draft docs, you will find a link to JIRA to open a doc issue for example.

1 Comment

Filed under Access Management