website/integrations/chat-communication-collaboration/sharepoint-se/index.md
SharePoint is a proprietary, web-based collaborative platform that integrates natively with Microsoft 365.
Launched in 2001, SharePoint is primarily sold as a document management and storage system, although it is also used for sharing information through an intranet, implementing internal applications, and for implementing business processes.
Organizations use Microsoft SharePoint to create websites.
You can use it as a secure place to store, organize, share, and access information from any device. All you need is a web browser, such as Microsoft Edge, Internet Explorer, Chrome, or Firefox.
-- https://support.microsoft.com/en-us/office/what-is-sharepoint-97b915e6-651b-43b2-827d-fb25777f446f
:::info There are many ways to implement an SSO mechanism within Microsoft SharePoint Server Subscription Edition.
These guidelines provide a procedure to integrate authentik with an OIDC provider based on Microsoft documentation. (cf. https://learn.microsoft.com/en-us/sharepoint/security-for-sharepoint-server/set-up-oidc-auth-in-sharepoint-server-with-msaad)
In addition, they provide a procedure to enable claims augmentation in order to resolve group memberships.
For all other integration models, read Microsoft's official documentation. (cf. https://learn.microsoft.com/en-us/sharepoint/security-for-sharepoint-server/plan-user-authentication) :::
:::caution This setup only works starting with authentik version 2023.10 and Microsoft SharePoint Subscription Edition starting with the Cumulative Updates of September 2023. :::
When you configure OIDC with authentik, you need the following resources:
:::info Ensure that the authentik and SharePoint Server clocks are synchronized. :::
These guidelines use the following placeholders for the overall setup:
| Name | Placeholder | Sample value |
|---|---|---|
| authentik Application Name | auth.applicationName | SharePoint SE |
| authentik Application Slug | auth.applicationSlug | sharepoint-se |
| authentik OIDC Name | auth.providerName | OIDC-SP |
| authentik OIDC Configuration URL | auth.providerConfigURL | https://authentik.company/application/o/sharepoint-se/.well-known/openid-configuration |
| authentik OIDC Client ID | auth.providerClientID | 0ab1c234d567ef8a90123bc4567890e12fa3b45c |
| authentik OIDC Redirect URIs | auth.providerRedirectURI | https://sharepoint.company/.\* |
| (Optional) authentik LDAP Outpost URI | ldap.outpostURI | ak-outpost-ldap.authentik.svc.cluster.local |
| (Optional) authentik LDAP Service Account | ldap.outpostServiceAccount | cn=ldapservice,ou=users,dc=ldap,dc=goauthentik,dc=io |
| (Optional) authentik LDAP Service Account Password | ldap.outpostServiceAccountPassword | mystrongpassword |
| SharePoint Default Web Application URL | sp.webAppURL | https://sharepoint.company |
| SharePoint Trusted Token Issuer Name | sp.issuerName | Authentik |
| SharePoint Trusted Token Issuer Description | sp.issuerDesc | authentik IDP |
SharePoint requires additional properties within the OpenID and profile scopes in order to operate OIDC properly and map incoming authentik OID claims with Microsoft claims.
Additional information from Microsoft documentation:
From the authentik Admin Dashboard:
return {
"nbf": "0", # Identifies the time before which the JWT can't be accepted for processing.
# 0 stands for the date 1970-01-01 in Unix timestamp
"oid": user.uid, # This ID uniquely identifies the user across applications - two different applications signing in the same user receives the same value in the oid claim.
"upn": user.username # (Optional) User Principal Name, used for troubleshooting within JWT tokens or to setup SharePoint like ADFS
}
From the authentik Admin Dashboard:
return {
"name": request.user.name, # The name claim provides a human-readable value that identifies the subject of the token.
"given_name": request.user.name, # Interoperability with Microsoft Entra ID
"unique_name": request.user.name, # (Optional) Used for troubleshooting within JWT tokens or to setup SharePoint like ADFS
"preferred_username": request.user.username, # (Optional) The primary username that represents the user.
"nickname": request.user.username, # (Optional) Used for troubleshooting within JWT tokens or to setup SharePoint like ADFS
"roles": [group.name for group in request.user.groups.all()], # The set of roles that were assigned to the user who is logging in.
}
From the authentik Admin Dashboard:
auth.providerNameauth.providerRedirectURIFrom the authentik Admin Dashboard:
auth.applicationNameauth.applicationSlugauth.providerNamesp.webAppURLUpdate the following PowerShell script for your environment, then run it on a SharePoint Server as a Farm Admin account with elevated privileges.
:::caution
:::
Add-PSSnapin microsoft.sharepoint.powershell
# Setup farm properties to work with OIDC
$cert = New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -Provider 'Microsoft Enhanced RSA and AES Cryptographic Provider' -Subject "CN=SharePoint Cookie Cert"
$rsaCert = [System.Security.Cryptography.X509Certificates.RSACertificateExtensions]::GetRSAPrivateKey($cert)
$fileName = $rsaCert.key.UniqueName
#If you have multiple SharePoint servers in the farm, you need to export certificate by Export-PfxCertificate and import certificate to all other SharePoint servers in the farm by Import-PfxCertificate and apply the same permissions as below.
#After certificate is successfully imported to SharePoint Server, we will need to grant access permission to certificate private key.
$path = "$env:ALLUSERSPROFILE\Microsoft\Crypto\RSA\MachineKeys\$fileName"
$permissions = Get-Acl -Path $path
#Please replace the <web application pool account> with the real application pool account of your web application.
$access_rule = New-Object System.Security.AccessControl.FileSystemAccessRule("$($env:computername)\WSS_WPG", 'Read', 'None', 'None', 'Allow')
$permissions.AddAccessRule($access_rule)
Set-Acl -Path $path -AclObject $permissions
#Then we update farm properties only once.
$f = Get-SPFarm
$f.Farm.Properties['SP-NonceCookieCertificateThumbprint']=$cert.Thumbprint
$f.Farm.Properties['SP-NonceCookieHMACSecretKey']='seed'
$f.Farm.Update()
Update the SharePoint farm to accept OAuth authentication over HTTP.
Update the following PowerShell script for your environment, then run it on a SharePoint Server as a Farm Admin account with elevated privileges.
Add-PSSnapin microsoft.sharepoint.powershell
$c = get-spsecuritytokenserviceconfig
$c.AllowOAuthOverHttp = $true
$c.update()
Update the following PowerShell script for your environment, then run it on a SharePoint Server as a Farm Admin account with elevated privileges.
:::caution
:::
Add-PSSnapin microsoft.sharepoint.powershell
# OIDC Settings
$metadataendpointurl = "auth.providerConfigURL"
$clientIdentifier = "auth.providerClientID"
$trustedTokenIssuerName = "sp.issuerName"
$trustedTokenIssuerDescription = "sp.issuerDesc"
# OIDC Claims Mapping
## Identity claim: oid => defined within the Authentik scope mapping
$idClaim = New-SPClaimTypeMapping "http://schemas.microsoft.com/identity/claims/objectidentifier" -IncomingClaimTypeDisplayName "oid" -SameAsIncoming
## User claims mappings
$claims = @(
$idClaim
## User Roles (Group membership)
,(New-SPClaimTypeMapping ([System.Security.Claims.ClaimTypes]::Role) -IncomingClaimTypeDisplayName "Role" -SameAsIncoming)
## User email
,(New-SPClaimTypeMapping ([System.Security.Claims.ClaimTypes]::Email) -IncomingClaimTypeDisplayName "Email" -SameAsIncoming)
## User given_name
,(New-SPClaimTypeMapping ([System.Security.Claims.ClaimTypes]::GivenName) -IncomingClaimTypeDisplayName "GivenName" -SameAsIncoming )
## (Optional) User account name
#,(New-SPClaimTypeMapping ([System.Security.Claims.ClaimTypes]::NameIdentifier) -IncomingClaimTypeDisplayName "Username" -SameAsIncoming)
)
# Trust 3rd party identity token issuer
$trustedTokenIssuer = New-SPTrustedIdentityTokenIssuer -Name $trustedTokenIssuerName -Description $trustedTokenIssuerDescription -ClaimsMappings $claims -IdentifierClaim $idClaim.InputClaimType -DefaultClientIdentifier $clientIdentifier -MetadataEndPoint $metadataendpointurl -Scope "openid email profile"
#Note: Remove the profile scope if you plan to use the LDAPCP claims augmentation.
# Create the SharePoint authentication provider based on the trusted token issuer
New-SPAuthenticationProvider -TrustedIdentityTokenIssuer $trustedTokenIssuer
From the Central Administration opened as a Farm Administrator:
sp.webAppURL.sp.issuerNameRepeat these steps for each target web application that matches auth.providerRedirectURI.
Objectives:
:::caution LDAPCP must be installed on the target SharePoint farm. :::
Update the following PowerShell script for your environment, then run it on a SharePoint Server as a Farm Admin account with elevated privileges.
:::caution
:::
Add-PSSnapin microsoft.sharepoint.powershell
$trustedTokenIssuerName = "sp.issuerName"
$sptrust = Get-SPTrustedIdentityTokenIssuer $trustedTokenIssuerName
$sptrust.ClaimProviderName = "LDAPCP"
$sptrust.Update()
From the SharePoint Central Administration opened as a Farm Administrator:
| Claim type | Entity type | LDAP class | LDAP Attribute to query | LDAP attribute to display | PickerEntity metadata |
|---|---|---|---|---|---|
| http://schemas.microsoft.com/identity/claims/objectidentifier | User | user | uid | sn | UserId |
| LDAP attribute linked to the main mapping for object User | User | user | |||
| LDAP attribute linked to the main mapping for object User | User | user | sn | DisplayName | |
| http://schemas.microsoft.com/ws/2008/06/identity/claims/role | Group | group | cn | DisplayName | |
| LDAP attribute linked to the main mapping for object Group | Group | group | uid | SPGroupID |
From the authentik Admin Dashboard:
:::info The following procedure applies to an authentik deployment within Kubernetes.
For other kinds of deployment, please refer to the authentik documentation. :::
ldap.outpostServiceAccount and a searchable group of users & groupsauth.applicationName.From the SharePoint Central Administration opened as a Farm Administrator:
ldap.outpostURI/dc=ldap,dc=goauthentik,dc=ioldap.outpostServiceAccountldap.outpostServiceAccountPasswordldap.outpostURINote: The ldap.outpostURI should be the IP, hostname, or FQDN of the LDAP Outpost service deployed accessible by your SharePoint farm.