forked from ovidner/python-social-auth-liu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddLiURelyingPartyTrust.ps1
More file actions
42 lines (37 loc) · 1.73 KB
/
AddLiURelyingPartyTrust.ps1
File metadata and controls
42 lines (37 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
param(
[string]$name = $(throw "Name for the application is required."),
[string]$realm = $(throw "Realm for the application is required. E.g.: http://whatever.com or urn:whatever.")
)
# Remove existing
if (Get-ADFSRelyingPartyTrust -Identifier $realm) {
Write-Host "Removing existing Relying Party Trust $realm"
Remove-ADFSRelyingPartyTrust -TargetIdentifier $realm
}
$transformRules = @'
@RuleTemplate = "LdapClaims"
@RuleName = "GUID, UPN, email address, full name, first name, last name, norEduPersonLIN as claims"
c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
=> issue(
store = "Active Directory",
types = (
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname",
"http://liu.se/claims/norEduPersonLIN"
),
query = ";objectGUID,userPrincipalName,mail,displayName,givenName,sn,norEduPersonLIN;{0}",
param = c.Value
);
'@
$authorizationRules = @'
@RuleTemplate = "AllowAllAuthzRule"
=> issue(
Type = "http://schemas.microsoft.com/authorization/claims/permit",
Value = "true"
);
'@
Add-ADFSRelyingPartyTrust -Name $name -Identifier $realm -EnableJWT $true -IssuanceTransformRules $transformRules -IssuanceAuthorizationRules $authorizationRules
Write-Host "Relying Party Trust '$name' ($realm) added succesfully."