# AD FS Configuration

{% hint style="info" %}
For a 100% cloud-based integration with AD FS, see [Keeper SSO Connect Cloud](https://docs.keeper.io/sso-connect-cloud)
{% endhint %}

### Microsoft AD FS

#### Obtain Federation Metadata XML

Inside the AD FS Management application, locate the Federation Metadata xml file. This can be found by clicking on AD FS > Service > Endpoints then locate the URL path in the "Metadata" section. The path is typically **/FederationMetadata/2007-06/FederationMetadata.xml** as seen below:

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1maMce1G7EIWBDAqD%2F-LU1mpCZXEV1VKrRMQMl%2Fsso-step-28b.png?alt=media&#x26;token=47770445-f009-46b7-8b6d-ebe61f1b64f7" alt=""></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1maMce1G7EIWBDAqD%2F-LU1n-HgqddGF50JEdIm%2Fsso-step-194b.png?alt=media&#x26;token=7263e203-910a-41a5-9fcb-4926b839658f" alt=""></div>

To download the metadata file, this can typically be found by loading the URL in the browser on the server. For example:\
\
https\://\<your hostname>/FederationMetadata/2007-06/FederationMetadata.xml\
\
Download this file and save to the computer.

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1maMce1G7EIWBDAqD%2F-LU1n9AnW0jLc-Sq57G3%2Fsso-step-29b.png?alt=media&#x26;token=7e30beca-2b9e-4f36-82c3-6e3a7da41e4c" alt=""></div>

#### Import Federation Metadata

Import the FederationMetadata.xml file into Keeper SSO Connect’s configuration screen by dragging and dropping the file:

![](https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-Lvbhd4uMWI3pBu8I_it%2F-LvbkkLsX7-T-NRp2qGx%2Fadfs.png?alt=media\&token=101bda90-ee2a-498f-9d27-944b75ac2df1)

Select **Save** to save the configuration.

{% hint style="warning" %}
Please Note: ADFS signing certificates typically are only valid for a year. ADFS may automatically rotate to the most current certificate. This breaks the trust between Keeper SSO Connect and ADFS. A new federationMetadata.xml file will need to be generated and uploaded to the Keeper SSO Connect to ensure operation. We strongly recommend setting a reminder before the expiration of the certificate so this step can be performed to maintain operation.
{% endhint %}

#### Export Keeper SSO Connect Metadata

Select the **Export Metadata** link on Keeper SSO Connect and copy the sso\_connect.xml file to your IdP.

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LlELLNsxWEt_eMnwY5u%2F-LlELNMKVPjjG2VsjMNB%2FConfig_1_D.png?alt=media&#x26;token=5b2815ac-7edf-4864-b030-6856a6ae3f4a" alt=""></div>

#### Finish AD FS Configuration <a href="#finish-adfs-config" id="finish-adfs-config"></a>

#### Create Relying Trust Party

Create Keeper SSO Connect as a Relying Trust Party:

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1o6wRUFAIys_zZcFm%2Fsso-step-32b.png?alt=media&#x26;token=fe659023-f525-4b5b-879a-774237dfb999" alt=""></div>

#### Import Keeper Metadata

Import the Keeper Metadata that was exported previously from Keeper SSO Connect by completing the Relying Party Trust Wizard as seen in the steps below:

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1oK0o6AG933fIBu1h%2Fsso-step-33b.png?alt=media&#x26;token=875fd61c-22bb-4f86-a2af-b32af9b4d9dc" alt="Claims-aware applications"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1opmI1RtKsTkN8vlS%2Fsso-step-34b.png?alt=media&#x26;token=05d2aaf2-ad19-4cf5-9817-94d3635ce794" alt="Import data - Federation metadata file location"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1oZsVy5gZKHAOuG3p%2Fsso-step-35b.png?alt=media&#x26;token=11b8d534-6655-4fa4-900b-81bc21daccba" alt="Enter display name"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1p2rwvtjNiKea7qw4%2Fsso-step-36b.png?alt=media&#x26;token=93f8e20a-d74a-4d9b-ad3d-1f15d8524c67" alt="Choose an access control policy"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1pNevucVzJkJYRjty%2Fsso-step-37b.png?alt=media&#x26;token=f1e9d7ab-9ba0-417c-afa5-8672f899f378" alt="SAML Logout Endpoints"></div>

{% hint style="danger" %}
To prevent a logout error, change the SAML Logout Endpoints on the Relying Party Trust to: [https://**\<YourADFSserverDomain>**/adfs/ls/?wa=wsignout1.0](https://myadfsserver.domain.net/adfs/ls/?wa=wsignout1.0)
{% endhint %}

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1pmXPshiJSEfJNoHc%2Fsso-step-38b.png?alt=media&#x26;token=6bdad97b-eede-4a8d-9087-79ce93a46485" alt="Configure claims issuance policy"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1pygHDVLgoSNuCTth%2Fsso-step-39b.png?alt=media&#x26;token=23e8fd20-09b6-4f04-99bb-5ccc947329fb" alt="Relying Party Trusts"></div>

#### Create Claim Issuance Policy Rules <a href="#claim-issuance-policy" id="claim-issuance-policy"></a>

To map attributes between AD FS and Keeper, you need to create a Claim Issuance Policy with **Send LDAP Attributes as Claims** and map the LDAP attributes to Keeper Connect attributes.

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1qKB4OnjbazUPMFh6%2Fsso-step-40b.png?alt=media&#x26;token=fe33e163-f758-4dde-954b-7a4f516691f6" alt="Edit Claim Issuance Policy"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1qVxetZvyv2R_U_TK%2Fsso-step-41b.png?alt=media&#x26;token=f344cd7b-5eb8-41cb-99ff-272194d32275" alt="Add Rule..."></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1nSrx8aknvorYBcNs%2F-LU1qc4fRgwZDb6BK-Nn%2Fsso-step-42b.png?alt=media&#x26;token=a5b50390-a6f7-4d86-adad-fb4298148ef6" alt="Choose Rule Type"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1qxcVvkS6pSImdvok%2Fsso-step-43b.png?alt=media&#x26;token=a4883388-b664-462e-afbe-55d006c68957" alt="Claim Rule Name - Mapping"></div>

{% hint style="info" %}
**Important: Ensure that 3 attributes ("First", "Last" and "Email") are configured with the exact spelling as seen above**.
{% endhint %}

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1rNEgnCn7KPoeg2J2%2Fsso-step-44b.png?alt=media&#x26;token=3932b9f6-23ff-41ea-b526-dc645d208423" alt="Issuance Transform Rules"></div>

For Logout support we need to add two more Claim Issuance Policy rules:

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1rbrj7vyzzfldz42e%2Fsso-step-45b.png?alt=media&#x26;token=ac7886d6-18e4-4493-bff2-f85f4ae02f8e" alt="Send Claims using a Custom Rule"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1rm6NuW7rDmknjJCX%2Fsso-step-46b.png?alt=media&#x26;token=9b4393e8-992c-4014-bee2-f63b0ad6fa31" alt="Create Opaque Persistent ID"></div>

To copy the syntax to add in the claims rule, copy the following text and paste it into the custom rule:

```
c1:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]
 && c2:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant"]
 => add(store = "_OpaqueIdStore", types = ("http://mycompany/internal/sessionid"), query = "{0};{1};{2};{3};{4}", param = "useEntropy", param = c1.Value, param = c1.OriginalIssuer, param = "", param = c2.Value);
```

![](https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1s3_tgMhG9ln_DG92%2Fsso-step-47b.png?alt=media\&token=b50c7db8-4b14-4bee-a1a8-d288be5d5135)

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1sEMlpLmC2WXyXEQp%2Fsso-step-48b.png?alt=media&#x26;token=b7c374ff-4435-448b-90ed-22156cbd71cb" alt="Transform an Incoming Claim"></div>

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1sQUPRPp5wvbnOsE4%2Fsso-step-49b.png?alt=media&#x26;token=e8e4154c-80fb-4402-968c-0a1dbdb68f75" alt="Create Persistent Name Identifier"></div>

Incoming claim type: <http://mycompany/internal/sessionid>

<mark style="color:red;">Should I put my company's name in there? No, actually literally put "<http://mycompany/internal/sessionid>"</mark>

Outgoing claim type: Name ID\
Outgoing name ID format: Transient Identifier

<div align="left"><img src="https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LU1qslxsyM7trhYo7JN%2F-LU1sg-XUONZfzEkQGYC%2Fsso-step-50b.png?alt=media&#x26;token=ece4f776-f5e8-4618-b8f8-79503ee972c2" alt="Set Outgoing claim and name ID format"></div>

#### SAML Signing Configuration

a. Open Powershell as Administrator on the AD FS server.\
\
b. Identify your SSO Connect Relying Party Trust "Identifier" string which you can obtain by running:

```
Get-ADFSRelyingPartyTrust
```

Running this command will generate a long list of output, you are looking for the SSO Connect section and the "Identifier" string. This string will look something like:\
<https://xyx.company.com:8443/sso-connect>

c. Run the below command, replacing \<Identifier> with the string found in step (b).

```
Set-ADFSRelyingPartyTrust -TargetIdentifier <Identifier> -samlResponseSignature MessageAndAssertion
```

If you run Get-ADFSRelyingPartyTrust again, you'll see that the SamlResponseSignature section is set to "MessageAndAssertion".

#### Restart AD FS services

From the services manager, restart AD FS service.

![Restart AD FS](https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LvblaROrGm6NHxyd8Tf%2F-LvbpyoYrKzZ8bRDsBZN%2Frestart_adfs.png?alt=media\&token=43683c15-335b-4e69-939f-81944046014a)

{% hint style="info" %}
SAML assertion signing must be configured properly on your AD FS environment. If signing has not been configured, you will need to set this up, then exchange metadata again between AD FS and Keeper SSO Connect after the re-configuration.
{% endhint %}

#### Troubleshooting

If after setting up Keeper SSO Connect user gets **SSO is not configured (undefined)** a possible root cause is missing or incorrect CRL configuration.\
\
A simple fix/workaround is to disable all Certificate Revocation Check.

![](https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LlEMb6G159Z3VmhvUaX%2F-LlEMeTRpd8n70vcRHlK%2Fsso_error.png?alt=media\&token=8352b1f9-79d9-45fb-81b7-8956313d85b6)

![](https://2635959690-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTyMp7XGU8wh-hRPBiB%2F-LlEP8OulaN_wYuf9e9-%2F-LlEPAlR1ArIEbUWNF53%2FLog.png?alt=media\&token=475ecc3f-b817-46c4-aabe-ca51ddaee783)

Possible Root Causes\
\
Time skew\
\
Ensure that Keeper Connect and the IdP have the same identical system time (within 1 second).\
\
Set ntp sync\
\
PS C:\Windows\system32>w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org,0x8 /reliable:yes /update\
\
Certificate Validation Failure

* Verify the settings. Run a PowerShell as Administrator and look at ADFSRelyingPartyTrust
* Follow the "**SAML Signing Configuration**" instructions above

If you need to disable certificate validation on the IdP for testing purposes or for internal PKI certificates, you can use the below Powershell commands. Replace \<Identifier> with the string found in the "SAML Signing Configuration" instructions above.

```
Set-ADFSRelyingPartyTrust -TargetIdentifier 
<Identifier> -EncryptionCertificateRevocationCheck None
```

```
Set-ADFSRelyingPartyTrust -TargetIdentifier 
<Identifier> -SigningCertificateRevocationCheck None
```

Note: Any changes made to signing configuration may require exchange of XML metadata between IdP and SSO Connect.
