---
layout: default
title: CAS - Duo Security Authentication
---

# Duo Security Authentication

[Duo Security](https://www.duo.com) 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

```xml
<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:

```xml
<repository>
    <id>duo</id>
    <url>https://dl.bintray.com/uniconiam/maven</url>
</repository>
<repository>
    <id>duoclient</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 status matches either of those conditions or if the
user account is not registered yet the new-user enrollment policy allows folks to skip registration, CAS will bypass
Duo Security altogether, shall not challenge the user
and will also **NOT** report back a multifactor-enabled authentication context back to the application.

## Non-Browser MFA

The Duo Security module of CAS is able to also support [non-browser based multifactor authentication](https://duo.com/docs/authapi) 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.

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.

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.

```bash
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](Configuration-Properties.html#duosecurity).
