Duo Security Authentication

Duo Security is a two-step verification service the provides additional security for access to institutional and personal data.

Duo offers several options for authenticating users:

  • a mobile push notification and one-button verification of identity to a smartphone (requires the free Duo Mobile app)
  • a one-time code generated on a smartphone
  • a one-time code generated by Duo and sent to a handset via SMS text messaging
  • a telephone call from that will prompt you to validate the login request
1
2
3
4
5
<dependency>
     <groupId>org.apereo.cas</groupId>
     <artifactId>cas-server-support-duo</artifactId>
     <version>${cas.version}</version>
</dependency>

You may need to add the following repositories to the WAR overlay:

1
2
3
4
5
6
7
8
9
<repository>
    <id>duo-unicon</id>
    <url>https://dl.bintray.com/uniconiam/maven</url>
</repository>

<repository>
    <id>duo-jitpack</id>
    <url>https://jitpack.io</url>
</repository>

Multiple Instances

CAS multifactor authentication support for Duo Security allows multiple Duo providers to be configured with distinct ids each of which may be connected to a separate Duo Security instance with a different configuration. This behavior allows more sensitive applications to be connected to a Duo instance that has more strict and secure authentication policies.

For this behavior to function, separate unique ids of your own choosing need to be assigned to each Duo Security provider. Each provider instance is registered with CAS and activated in the authentication flows as necessary. The provider id need not be defined if there is only a single Duo instance available.

User Account Status

If users are unregistered with Duo Security or allowed through via a direct bypass, CAS will query Duo Security for the user account apriori to learn whether user is registered or configured for direct bypass. If the account is configured for direct bypass or the user account is not registered yet the new-user enrollment policy allows the user to skip registration, CAS will bypass Duo Security altogether and shall not challenge the user and will also NOT report back a multifactor-enabled authentication context back to the application.

YMMV

In recent conversations with Duo Security, it turns out that the API behavior has changed (for security reasons) where it may no longer accurately report back account status. This means even if the above conditions hold true, CAS may continue to route the user to Duo Security having received an eligibility status from the API. Duo Security is reportedly working on a fix to restore the AP behavior in a more secure way. In the meanwhile, YMMV.

Non-Browser MFA

The Duo Security module of CAS is able to also support non-browser based multifactor authentication requests. In order to trigger this behavior, applications (i.e. curl, REST APIs, etc) need to specify a special Content-Type to signal to CAS that the request is submitted from a non-web based environment. The multifactor authentication request is submitted to Duo Security in auto mode which effectively may translate into an out-of-band factor (push or phone) recommended by Duo as the best for the user’s devices.

In order to successfully complete the authentication flow, CAS must also be configured with a method of primary authentication that is able to support non-web based environments such as Basic Authentication.

Here is an example using curl that attempts to authenticate into a service by first exercising basic authentication while identifying the request content type as application/cas. It is assumed that the service below is configured in CAS with a special multifactor policy that forces the flow to pass through Duo Security as well.

1
curl --location --header "Content-Type: application/cas" https://apps.example.org/myapp -L -u casuser:Mellon

Configuration

To see the relevant list of CAS properties, please review this guide.