# SAML v2.0 Authentication

## Overview

SAML v2.0 provides enterprise-grade federated authentication with request ID tracking for security.  It allows WorkflowGen to delegate authentication to identity provider systems (IdPs) so that users can access the application with their existing corporate credentials.

## Configuration

{% hint style="info" %}
See the [OIDC configuration settings](#oidc-configuration-settings) section below for a table listing all of the required and optional settings, along with their descriptions and default values.
{% endhint %}

### Microsoft Entra ID

**Provider:** `saml-azure`

#### Required settings

```html
<add key="ApplicationSecurityAuthProvider" value="saml-azure" />
<add key="ApplicationSecurityAuthSAMLEntryPoint" value="https://login.microsoftonline.com/{tenant-id}/saml2" />
<add key="ApplicationSecurityAuthSAMLIssuer" value="https://{your-workflowgen-domain}/wfgen/auth" />
<add key="ApplicationSecurityAuthSAMLIdpIssuer" value="https://sts.windows.net/{tenant-id}/" />
<add key="ApplicationSecurityAuthSAMLCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSAMLPrivateKey" value="-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----" />
<add key="ApplicationSecurityAuthSAMLIdpCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSessionTokenSigningSecret" value="your-session-secret" />
```

#### Optional settings

**Complete sign-out via portal**

```html
<add key="ApplicationSecurityAuthSAMLLogoutPortalUrl" value="https://myapps.microsoft.com/logout" />
```

**SP-initiated SL**

```html
<add key="ApplicationSecurityAuthSAMLLogoutUrl" value="https://login.microsoftonline.com/{tenant-id}/saml2" />
```

{% hint style="info" %}
If `ApplicationSecurityAuthSAMLLogoutUrl` doesn't behave as expected for your tenant/browser setup, remove it (leave undefined) and rely on WorkflowGen-only logout or portal logout via `https://myapps.microsoft.com/logout`.
{% endhint %}

### PingFederate

**Provider**: `saml-pingfederate`

#### Required settings

<pre class="language-html"><code class="lang-html">&#x3C;add key="ApplicationSecurityAuthProvider" value="saml-pingfederate" />
&#x3C;add key="ApplicationSecurityAuthSAMLEntryPoint" value="https://auth.pingone.ca/{environment-id}/saml20/idp/sso" />
&#x3C;add key="ApplicationSecurityAuthSAMLIssuer" value="https://{your-workflowgen-domain}/wfgen/auth" />
&#x3C;add key="ApplicationSecurityAuthSAMLIdpIssuer" value="https://auth.pingone.ca/{environment-id}" />
&#x3C;add key="ApplicationSecurityAuthSAMLCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
&#x3C;add key="ApplicationSecurityAuthSAMLPrivateKey" value="-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----" />
&#x3C;add key="ApplicationSecurityAuthSAMLIdpCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
&#x3C;add key="ApplicationSecurityAuthSessionTokenSigningSecret" value="your-session-secret" />
<strong>&#x3C;!-- PingFederate wants logout requests to be signed - required for PingFederate SLO -->
</strong>&#x3C;add key="ApplicationSecurityAuthSAMLWantLogoutRequestsSigned" value="true" />
&#x3C;!-- PingFederate wants assertions to be signed - required for PingFederate SLO -->
&#x3C;add key="ApplicationSecurityAuthSAMLWantAssertionsSigned" value="true" />
</code></pre>

#### Optional settings

**Complete sign-out via portal**

```html
<add key="ApplicationSecurityAuthSAMLLogoutPortalUrl" value="https://auth.pingone.ca/{environment-id}/saml20/idp/slo" />
```

**SP-initiated SLO**

```html
<add key="ApplicationSecurityAuthSAMLLogoutUrl" value="https://auth.pingone.ca/{environment-id}/saml20/idp/slo" />
```

### Auth0

**Provider:** `saml-auth0`

#### Required settings

```html
<add key="ApplicationSecurityAuthProvider" value="saml-auth0" />
<add key="ApplicationSecurityAuthSAMLEntryPoint" value="https://{tenant-id}.auth0.com/samlp/{client-id}" />
<add key="ApplicationSecurityAuthSAMLIssuer" value="https://{your-workflowgen-domain}/wfgen/auth" />
<add key="ApplicationSecurityAuthSAMLIdpIssuer" value="urn:{tenant-id}.auth0.com" />
<add key="ApplicationSecurityAuthSAMLCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSAMLPrivateKey" value="-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----" />
<add key="ApplicationSecurityAuthSAMLIdpCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSessionTokenSigningSecret" value="your-session-secret" />
<!-- Auth0 wants assertions to be signed - required for Auth0 SLO -->
<add key="ApplicationSecurityAuthSAMLWantAssertionsSigned" value="true" />
```

#### Optional settings

**Complete sign-out via portal**

```html
<add key="ApplicationSecurityAuthSAMLLogoutPortalUrl" value="https://{tenant-id}.auth0.com/logout" />
```

**SP-initiated SLO**

```html
<add key="ApplicationSecurityAuthSAMLLogoutUrl" value="https://{tenant-id}.auth0.com/samlp/{client-id}/logout" />
```

### Okta

**Provider:** `okta-saml`

#### Required settings

```html
<add key="ApplicationSecurityAuthProvider" value="saml-okta" />
<add key="ApplicationSecurityAuthSAMLEntryPoint" value="https://{okta-domain-id}.okta.com/app/{app-name}/{app-id}/sso/saml" />
<add key="ApplicationSecurityAuthSAMLIssuer" value="https://{your-workflowgen-domain}/wfgen/auth" />
<add key="ApplicationSecurityAuthSAMLIdpIssuer" value="https://www.okta.com/{app-id}" />
<add key="ApplicationSecurityAuthSAMLCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSAMLPrivateKey" value="-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----" />
<add key="ApplicationSecurityAuthSAMLIdpCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSessionTokenSigningSecret" value="your-session-secret" />
```

#### Optional settings

**Complete sign-out via portal**

```html
<add key="ApplicationSecurityAuthSAMLLogoutPortalUrl" value="https://{okta-domain-id}.okta.com/login/signout" />
```

**SP-initiated SLO**

```html
<add key="ApplicationSecurityAuthSAMLLogoutUrl" value="https://{okta-domain-id}.okta.com/app/{app-name}/{app-id}/slo/saml" />
```

{% hint style="info" %}
If `ApplicationSecurityAuthSAMLLogoutUrl` doesn't work as expected (e.g., Okta returns `RequestDenied`/`AuthnFailed`), leave it undefined and use portal logout via `/wfgen/auth/logout?logoutType=complete`.
{% endhint %}

### AD FS

{% hint style="warning" %}
SAML v2.0 support for AD FS is still in experimental mode. You should test the configuration for compatibility.
{% endhint %}

**Provider:** `saml-adfs`

#### Required settings

```html
<add key="ApplicationSecurityAuthProvider" value="saml-adfs" />
<add key="ApplicationSecurityAuthSAMLEntryPoint" value="https://{your-adfs-server}/adfs/ls/" />
<add key="ApplicationSecurityAuthSAMLIssuer" value="https://{your-workflowgen-domain}/wfgen/auth" />
<add key="ApplicationSecurityAuthSAMLIdpIssuer" value="https://{your-adfs-server}/adfs/services/trust" />
<add key="ApplicationSecurityAuthSAMLCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSAMLPrivateKey" value="-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----" />
<add key="ApplicationSecurityAuthSAMLIdpCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSessionTokenSigningSecret" value="your-session-secret" />
```

#### Optional settings

**Complete sign-out via portal**

```html
<add key="ApplicationSecurityAuthSAMLLogoutPortalUrl" value="https://{your-adfs-server}/adfs/ls/?wa=wsignout1.0" />
```

**SP-initiated SLO**

```html
<add key="ApplicationSecurityAuthSAMLLogoutUrl" value="https://{your-adfs-server}/adfs/ls/?wa=wsignout1.0" />
```

### Generic providers

{% hint style="warning" %}
SAML v2.0 authentication support for generic IdPs is still in experimental mode. You should test the configuration for compatibility.
{% endhint %}

**Provider:** `saml-generic`

#### Required settings

```html
<add key="ApplicationSecurityAuthProvider" value="saml-generic" />
<add key="ApplicationSecurityAuthSAMLEntryPoint" value="https://{your-idp-server}/sso/saml" />
<add key="ApplicationSecurityAuthSAMLIssuer" value="https://{your-workflowgen-domain}/wfgen/auth" />
<add key="ApplicationSecurityAuthSAMLIdpIssuer" value="https://{your-idp-server}" />
<add key="ApplicationSecurityAuthSAMLCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSAMLPrivateKey" value="-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----" />
<add key="ApplicationSecurityAuthSAMLIdpCert" value="-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" />
<add key="ApplicationSecurityAuthSessionTokenSigningSecret" value="your-session-secret" />
```

#### Optional settings

**Complete sign-out via portal**

```html
<add key="ApplicationSecurityAuthSAMLLogoutPortalUrl" value="https://{your-idp-server}/logout" />
```

**SP-initiated SLO**

```html
<add key="ApplicationSecurityAuthSAMLLogoutUrl" value="https://{your-idp-server}/slo/saml" />
```

## OIDC configuration settings

<table><thead><tr><th width="521.8291015625" valign="top">Setting</th><th width="239.32470703125" valign="top">Description &#x26; values</th></tr></thead><tbody><tr><td valign="top"><strong>Core settings</strong></td><td valign="top"></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthProviders</code><br>(required)</td><td valign="top">Identity provider identifier<br><strong>Default:</strong> Not set</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthClientId</code><br><br><br>(required)<br> <br><br><br> </td><td valign="top">OAuth client ID<br><strong>Default:</strong> Not set</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthClientSecret</code><br>(required)</td><td valign="top">OAuth client secret<br><strong>Default:</strong> Not set</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthMetadataUrl</code><br>(required) </td><td valign="top">OIDC metadata endpoint<br><strong>Default: Not set</strong></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthSessionTokenSigningSecret</code><br>(required)</td><td valign="top">JWT signing secret<br><strong>Default:</strong> Not set</td></tr><tr><td valign="top"><strong>User claims</strong></td><td valign="top"></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthUsernameClaim</code></td><td valign="top">Username claim name<br><strong>Default:</strong> <code>preferred_username</code></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthAppIdClaim</code></td><td valign="top">App ID claim name<br><strong>Default:</strong> <code>appid</code></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthAccessTokenUsernameClaim</code></td><td valign="top">Access token username claim<br><strong>Default:</strong> <code>upn</code></td></tr><tr><td valign="top"><strong>Token settings</strong></td><td valign="top"></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthAudience</code></td><td valign="top">Token audience validation<br><strong>Default:</strong> Empty</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthDecodeAccessToken</code></td><td valign="top">Decode access token<br><strong>Default:</strong> <code>N</code></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthExposeAccessTokenInCookies</code></td><td valign="top">Expose token in cookies<br><strong>Default:</strong> <code>N</code></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthClockTolerance</code></td><td valign="top">JWT clock tolerance (seconds)<br><strong>Default:</strong> <code>60</code></td></tr><tr><td valign="top"><strong>Session &#x26; flow</strong></td><td valign="top"></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthSessionTokenSigningSecret</code><br> (required) </td><td valign="top">JWT session token signing secret<br><strong>Default:</strong> Not set</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthSessionTokenAudience</code></td><td valign="top">JWT session token audience<br><strong>Default:</strong> Application URL</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthSessionTimeOut</code></td><td valign="top">Session timeout (seconds)<br><strong>Default:</strong> Not set</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthMobileSessionTimeOut</code></td><td valign="top">Mobile session timeout (seconds)<br><strong>Default:</strong> <code>7200</code>  <br></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthResponseMode</code></td><td valign="top">OIDC response mode<br><strong>Default:</strong> <code>form_post</code></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthSessionRefreshEnableIFrame</code></td><td valign="top">Enable iframe refresh<br><strong>Default:</strong> <code>Y</code></td></tr><tr><td valign="top"><code>ApplicationSecurityAuthCheckSessionUrl</code></td><td valign="top">Check session iframe URL<br><strong>Default:</strong> Empty</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthLogoutUrl</code></td><td valign="top">Custom logout URL<br><strong>Default:</strong> Empty</td></tr><tr><td valign="top"><code>ApplicationSecurityAuthAcrValues</code></td><td valign="top">Authentication context class<br><strong>Default:</strong> Empty</td></tr></tbody></table>
