Doing some Fiddler traces recently and these tips helped me.
Modern browsers are far stricter about security and using Fiddler sometimes blocks a process that works fine without.
These settings help:
Also, sometimes you can't get round an issue.
What you can do is use IE's Developer Tools (F12).
Network tab - "Export captured traffic".
Then import the saved file into Fiddler.
If you use Chrome, you can save the trace as a .har file.
You can "Import Sessions" on Fiddler and then select "HTTPArchive".
Enjoy!
Ideas and thoughts about Microsoft Identity, C# development, cabbages and kings and random flotsam on the incoming tide
Wednesday, November 22, 2017
Monday, November 20, 2017
ADFS : ADFS Help
This tool has been extended with more scripts and tooling.
For the log tools:
"AdfsEventsModule Overview
This module provides tools for gathering related ADFS events from the security, admin, and debug logs, across multiple servers. This tool also allows the user to reconstruct the HTTP request/response headers from the logs.
Cmdlets in AdfsEventsModule
This module exposes two cmdlets:
Get-ADFSEvents
and
Write-ADFSEventsSummary
The detailed parameters for each are provided below.
The Get-ADFSEvents cmdlet is used to aggregate events by correlation ID, while the Write-ADFSEventsSummary cmdlet is used to generate a PowerShell Table of only the most relevant logging information from the events that are piped in."
For the Diagnostics, this downloads a PowerShell module that you need to import:
import-module -name .\ADFSDiagnostics.psm1 -verbose
VERBOSE: Loading module from path 'C:\junk\ADFSDiagnostics.psm1'.
VERBOSE: Importing function 'Get-AdfsServerConfiguration'.
VERBOSE: Importing function 'Get-AdfsServerTrace'.
VERBOSE: Importing function 'Get-AdfsSystemInformation'.
VERBOSE: Importing function 'Get-AdfsVersionEx'.
VERBOSE: Importing function 'Receive-AdfsServerTrace'.
VERBOSE: Importing function 'Set-ADFSDiagTestMode'.
VERBOSE: Importing function 'Start-AdfsServerTrace'.
VERBOSE: Importing function 'Test-AdfsServerHealth'.
VERBOSE: Importing function 'Test-AdfsServerHealthSingleCheck'.
VERBOSE: Importing function 'Test-AdfsServerToken'.
Some examples:
Get-AdfsSystemInformation
OSVersion : 10.0.14393.0
OSName : Microsoft Windows Server 2016 Datacenter
MachineDomain : dev.local
IPAddress : 100.75.64.15
TimeZone : Coordinated Universal Time
LastRebootTime : 10/24/2017 6:49:22 PM
MachineType : Virtual Machine
NumberOfLogicalProcessors : 1
MaxClockSpeed : 2394
PhsicalMemory : 1792
Hosts : {}
Hotfixes : {KB4023834, KB3199986, KB4013418, KB4035631...}
AdfsWmiProperties : {ConfigurationDatabaseConnectionString, ConfigurationServiceAddress,
ConfigurationChannelMaxMessageSizeInBytes}
SslBindings : {System.Collections.Hashtable, System.Collections.Hashtable, System.Collections.Hashtable,
System.Collections.Hashtable...}
AdfssrvServiceAccount : DEV\xxx
AdfsVersion : 3.0
Role : STS
Top10ProcessesByMemory : {@{Name=Microsoft.Sirona.OMS.Security.BaselineAssessment; MemoryInMB=80.625;
MemoryPercentOfTotal=4.49916294642857},
@{Name=Microsoft.Identity.AadConnect.Health.AadSync.Host; MemoryInMB=76.25390625;
MemoryPercentOfTotal=4.25524030412946}, @{Name=miiserver; MemoryInMB=57.1640625;
MemoryPercentOfTotal=3.18995884486607}, @{Name=MsMpEng; MemoryInMB=47.8046875;
MemoryPercentOfTotal=2.66767229352679}...}
AdHealthAgentInformation : AdHealthAgentInformation
Get-AdfsServerConfiguration
ADFSSyncProperties : Microsoft.IdentityServer.Management.Resources.SyncPropertiesBase
ADFSAttributeStore : {Microsoft.IdentityServer.Management.Resources.AttributeStore,
Microsoft.IdentityServer.Management.Resources.AttributeStore}
ADFSCertificate : {@{Certificate=[Subject]
CN=xxx
[Issuer]
CN=xxx
[Serial Number]
62...D7
[Not Before]
8/21/2017 12:00:00 PM
[Not After]
8/28/2027 12:00:00 PM
[Thumbprint]
24...35
; CertificateType=Service-Communications; IsPrimary=True; StoreName=My;
StoreLocation=LocalMachine;
Thumbprint=24...35},
@{Certificate=[Subject]
CN=ADFS Encryption - xxx
[Issuer]
CN=ADFS Encryption - xxx
[Serial Number]
70...6B
[Not Before]
11/2/2017 8:31:02 PM
[Not After]
11/2/2018 8:31:02 PM
[Thumbprint]
ED...13
; CertificateType=Token-Decrypting; IsPrimary=True; StoreName=My;
StoreLocation=CurrentUser;
Thumbprint=ED...13},
@{Certificate=[Subject]
CN=ADFS Signing - xxx
[Issuer]
CN=ADFS Signing - xxx
[Serial Number]
6B...00
[Not Before]
11/2/2017 8:31:14 PM
[Not After]
11/2/2018 8:31:14 PM
[Thumbprint]
D1...F3
; CertificateType=Token-Signing; IsPrimary=True; StoreName=My;
StoreLocation=CurrentUser;
Thumbprint=D1...F3},
@{Certificate=[Subject]
CN=ADFS Encryption - xxx
[Issuer]
CN=ADFS Encryption - xxx
[Serial Number]
4C...95
[Not Before]
11/22/2016 7:34:42 PM
[Not After]
11/22/2017 7:34:42 PM
[Thumbprint]
94...35
; CertificateType=Token-Decrypting; IsPrimary=False; StoreName=My;
StoreLocation=CurrentUser;
Thumbprint=94...35}...}
ADFSClaimDescription : {Microsoft.IdentityServer.Management.Resources.ClaimDescription,
Microsoft.IdentityServer.Management.Resources.ClaimDescription,
Microsoft.IdentityServer.Management.Resources.ClaimDescription,
Microsoft.IdentityServer.Management.Resources.ClaimDescription...}
ADFSEndpoint : {Microsoft.IdentityServer.Management.Resources.Endpoint,
Microsoft.IdentityServer.Management.Resources.Endpoint,
Microsoft.IdentityServer.Management.Resources.Endpoint,
Microsoft.IdentityServer.Management.Resources.Endpoint...}
ADFSProperties : Microsoft.IdentityServer.Management.Resources.ServiceProperties
ADFSRelyingPartyTrustCount : 4
ADFSClaimsProviderTrustCount : 6
ADFSConfigurationDatabaseConnectionString : Data Source=np:\\.\pipe\microsoft##wid\tsql\query;Initial
Catalog=AdfsConfigurationV3;Integrated Security=True
AdfssrvServiceAccount : DEV\xxx
AdfsVersion : 3.0
AadTrustStatus : Not Configured
ADFSAdditionalAuthenticationRule :
ADFSClient : {Microsoft.IdentityServer.Management.Resources.AdfsClient,
Microsoft.IdentityServer.Management.Resources.AdfsClient,
Microsoft.IdentityServer.Management.Resources.AdfsClient,
Microsoft.IdentityServer.Management.Resources.AdfsClient...}
ADFSGlobalAuthenticationPolicy : Microsoft.IdentityServer.Management.Resources.AdfsGlobalAuthenticationPolic
y
ADFSDeviceRegistration : Microsoft.IdentityServer.Management.Resources.DeviceRegistrationServiceObject
Test-AdfsServerHealth | ft Name,Result -AutoSize
Name Result
---- ------
IsAdfsRunning Pass
IsWidRunning Pass
PingFederationMetadata Pass
CheckAdfsSslBindings Pass
Test-Certificate-Token-Decrypting-Primary-NotFoundInStore NotRun
Test-Certificate-Token-Decrypting-Primary-IsSelfSigned NotRun
Test-Certificate-Token-Decrypting-Primary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Decrypting-Primary-Expired Pass
Test-Certificate-Token-Decrypting-Primary-Revoked Pass
Test-Certificate-Token-Decrypting-Primary-AboutToExpire NotRun
Test-Certificate-Token-Signing-Primary-NotFoundInStore NotRun
Test-Certificate-Token-Signing-Primary-IsSelfSigned NotRun
Test-Certificate-Token-Signing-Primary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Signing-Primary-Expired Pass
Test-Certificate-Token-Signing-Primary-Revoked Pass
Test-Certificate-Token-Signing-Primary-AboutToExpire NotRun
Test-Certificate-SSL-Primary-NotFoundInStore Pass
Test-Certificate-SSL-Primary-IsSelfSigned Fail
Test-Certificate-SSL-Primary-PrivateKeyAbsent Pass
Test-Certificate-SSL-Primary-Expired Pass
Test-Certificate-SSL-Primary-Revoked Pass
Test-Certificate-SSL-Primary-AboutToExpire Pass
Test-Certificate-Token-Decrypting-Secondary-NotFoundInStore NotRun
Test-Certificate-Token-Decrypting-Secondary-IsSelfSigned NotRun
Test-Certificate-Token-Decrypting-Secondary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Decrypting-Secondary-Expired Pass
Test-Certificate-Token-Decrypting-Secondary-Revoked Pass
Test-Certificate-Token-Decrypting-Secondary-AboutToExpire NotRun
Test-Certificate-Token-Signing-Secondary-NotFoundInStore NotRun
Test-Certificate-Token-Signing-Secondary-IsSelfSigned NotRun
Test-Certificate-Token-Signing-Secondary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Signing-Secondary-Expired Pass
Test-Certificate-Token-Signing-Secondary-Revoked Pass
Test-Certificate-Token-Signing-Secondary-AboutToExpire NotRun
CheckFarmDNSHostResolution Pass
CheckDuplicateSPN Pass
TestServiceAccountProperties Pass
TestAppPoolIDMatchesServiceID NotRun
TestComputerNameEqFarmName Pass
TestSSLUsingADFSPort NotRun
TestSSLCertSubjectContainsADFSFarmName Pass
TestAdfsAuditPolicyEnabled Fail
TestAdfsRequestToken Pass
CheckOffice365Endpoints Pass
TestADFSO365RelyingParty NotRun
TestNtlmOnlySupportedClientAtProxyEnabled Fail
Test-AdfsServerHealth | where {$_.Result -eq "Fail"} | fl
Name : Test-Certificate-SSL-Primary-IsSelfSigned
Result : Fail
Detail : SSL certificate with thumbprint 24...35 is self-signed.
Output : {Thumbprint}
ExceptionMessage :
Name : TestAdfsAuditPolicyEnabled
Result : Fail
Detail : Audits are not configured for Usage data collection : Expected 'Success and Failure', Actual='No
Auditing'
Output : {StsAuditConfig, MachineAuditPolicy}
ExceptionMessage :
Name : TestNtlmOnlySupportedClientAtProxyEnabled
Result : Fail
Detail : NtlmOnlySupportedClientAtProxy is disabled; extranet users can experience authentication failure.
Output : {NtlmOnlySupportedClientAtProxy}
ExceptionMessage :
More examples here.
Enjoy!
For the log tools:
"AdfsEventsModule Overview
This module provides tools for gathering related ADFS events from the security, admin, and debug logs, across multiple servers. This tool also allows the user to reconstruct the HTTP request/response headers from the logs.
Cmdlets in AdfsEventsModule
This module exposes two cmdlets:
Get-ADFSEvents
and
Write-ADFSEventsSummary
The detailed parameters for each are provided below.
The Get-ADFSEvents cmdlet is used to aggregate events by correlation ID, while the Write-ADFSEventsSummary cmdlet is used to generate a PowerShell Table of only the most relevant logging information from the events that are piped in."
For the Diagnostics, this downloads a PowerShell module that you need to import:
import-module -name .\ADFSDiagnostics.psm1 -verbose
VERBOSE: Loading module from path 'C:\junk\ADFSDiagnostics.psm1'.
VERBOSE: Importing function 'Get-AdfsServerConfiguration'.
VERBOSE: Importing function 'Get-AdfsServerTrace'.
VERBOSE: Importing function 'Get-AdfsSystemInformation'.
VERBOSE: Importing function 'Get-AdfsVersionEx'.
VERBOSE: Importing function 'Receive-AdfsServerTrace'.
VERBOSE: Importing function 'Set-ADFSDiagTestMode'.
VERBOSE: Importing function 'Start-AdfsServerTrace'.
VERBOSE: Importing function 'Test-AdfsServerHealth'.
VERBOSE: Importing function 'Test-AdfsServerHealthSingleCheck'.
VERBOSE: Importing function 'Test-AdfsServerToken'.
Some examples:
Get-AdfsSystemInformation
OSVersion : 10.0.14393.0
OSName : Microsoft Windows Server 2016 Datacenter
MachineDomain : dev.local
IPAddress : 100.75.64.15
TimeZone : Coordinated Universal Time
LastRebootTime : 10/24/2017 6:49:22 PM
MachineType : Virtual Machine
NumberOfLogicalProcessors : 1
MaxClockSpeed : 2394
PhsicalMemory : 1792
Hosts : {}
Hotfixes : {KB4023834, KB3199986, KB4013418, KB4035631...}
AdfsWmiProperties : {ConfigurationDatabaseConnectionString, ConfigurationServiceAddress,
ConfigurationChannelMaxMessageSizeInBytes}
SslBindings : {System.Collections.Hashtable, System.Collections.Hashtable, System.Collections.Hashtable,
System.Collections.Hashtable...}
AdfssrvServiceAccount : DEV\xxx
AdfsVersion : 3.0
Role : STS
Top10ProcessesByMemory : {@{Name=Microsoft.Sirona.OMS.Security.BaselineAssessment; MemoryInMB=80.625;
MemoryPercentOfTotal=4.49916294642857},
@{Name=Microsoft.Identity.AadConnect.Health.AadSync.Host; MemoryInMB=76.25390625;
MemoryPercentOfTotal=4.25524030412946}, @{Name=miiserver; MemoryInMB=57.1640625;
MemoryPercentOfTotal=3.18995884486607}, @{Name=MsMpEng; MemoryInMB=47.8046875;
MemoryPercentOfTotal=2.66767229352679}...}
AdHealthAgentInformation : AdHealthAgentInformation
Get-AdfsServerConfiguration
ADFSSyncProperties : Microsoft.IdentityServer.Management.Resources.SyncPropertiesBase
ADFSAttributeStore : {Microsoft.IdentityServer.Management.Resources.AttributeStore,
Microsoft.IdentityServer.Management.Resources.AttributeStore}
ADFSCertificate : {@{Certificate=[Subject]
CN=xxx
[Issuer]
CN=xxx
[Serial Number]
62...D7
[Not Before]
8/21/2017 12:00:00 PM
[Not After]
8/28/2027 12:00:00 PM
[Thumbprint]
24...35
; CertificateType=Service-Communications; IsPrimary=True; StoreName=My;
StoreLocation=LocalMachine;
Thumbprint=24...35},
@{Certificate=[Subject]
CN=ADFS Encryption - xxx
[Issuer]
CN=ADFS Encryption - xxx
[Serial Number]
70...6B
[Not Before]
11/2/2017 8:31:02 PM
[Not After]
11/2/2018 8:31:02 PM
[Thumbprint]
ED...13
; CertificateType=Token-Decrypting; IsPrimary=True; StoreName=My;
StoreLocation=CurrentUser;
Thumbprint=ED...13},
@{Certificate=[Subject]
CN=ADFS Signing - xxx
[Issuer]
CN=ADFS Signing - xxx
[Serial Number]
6B...00
[Not Before]
11/2/2017 8:31:14 PM
[Not After]
11/2/2018 8:31:14 PM
[Thumbprint]
D1...F3
; CertificateType=Token-Signing; IsPrimary=True; StoreName=My;
StoreLocation=CurrentUser;
Thumbprint=D1...F3},
@{Certificate=[Subject]
CN=ADFS Encryption - xxx
[Issuer]
CN=ADFS Encryption - xxx
[Serial Number]
4C...95
[Not Before]
11/22/2016 7:34:42 PM
[Not After]
11/22/2017 7:34:42 PM
[Thumbprint]
94...35
; CertificateType=Token-Decrypting; IsPrimary=False; StoreName=My;
StoreLocation=CurrentUser;
Thumbprint=94...35}...}
ADFSClaimDescription : {Microsoft.IdentityServer.Management.Resources.ClaimDescription,
Microsoft.IdentityServer.Management.Resources.ClaimDescription,
Microsoft.IdentityServer.Management.Resources.ClaimDescription,
Microsoft.IdentityServer.Management.Resources.ClaimDescription...}
ADFSEndpoint : {Microsoft.IdentityServer.Management.Resources.Endpoint,
Microsoft.IdentityServer.Management.Resources.Endpoint,
Microsoft.IdentityServer.Management.Resources.Endpoint,
Microsoft.IdentityServer.Management.Resources.Endpoint...}
ADFSProperties : Microsoft.IdentityServer.Management.Resources.ServiceProperties
ADFSRelyingPartyTrustCount : 4
ADFSClaimsProviderTrustCount : 6
ADFSConfigurationDatabaseConnectionString : Data Source=np:\\.\pipe\microsoft##wid\tsql\query;Initial
Catalog=AdfsConfigurationV3;Integrated Security=True
AdfssrvServiceAccount : DEV\xxx
AdfsVersion : 3.0
AadTrustStatus : Not Configured
ADFSAdditionalAuthenticationRule :
ADFSClient : {Microsoft.IdentityServer.Management.Resources.AdfsClient,
Microsoft.IdentityServer.Management.Resources.AdfsClient,
Microsoft.IdentityServer.Management.Resources.AdfsClient,
Microsoft.IdentityServer.Management.Resources.AdfsClient...}
ADFSGlobalAuthenticationPolicy : Microsoft.IdentityServer.Management.Resources.AdfsGlobalAuthenticationPolic
y
ADFSDeviceRegistration : Microsoft.IdentityServer.Management.Resources.DeviceRegistrationServiceObject
Test-AdfsServerHealth | ft Name,Result -AutoSize
Name Result
---- ------
IsAdfsRunning Pass
IsWidRunning Pass
PingFederationMetadata Pass
CheckAdfsSslBindings Pass
Test-Certificate-Token-Decrypting-Primary-NotFoundInStore NotRun
Test-Certificate-Token-Decrypting-Primary-IsSelfSigned NotRun
Test-Certificate-Token-Decrypting-Primary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Decrypting-Primary-Expired Pass
Test-Certificate-Token-Decrypting-Primary-Revoked Pass
Test-Certificate-Token-Decrypting-Primary-AboutToExpire NotRun
Test-Certificate-Token-Signing-Primary-NotFoundInStore NotRun
Test-Certificate-Token-Signing-Primary-IsSelfSigned NotRun
Test-Certificate-Token-Signing-Primary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Signing-Primary-Expired Pass
Test-Certificate-Token-Signing-Primary-Revoked Pass
Test-Certificate-Token-Signing-Primary-AboutToExpire NotRun
Test-Certificate-SSL-Primary-NotFoundInStore Pass
Test-Certificate-SSL-Primary-IsSelfSigned Fail
Test-Certificate-SSL-Primary-PrivateKeyAbsent Pass
Test-Certificate-SSL-Primary-Expired Pass
Test-Certificate-SSL-Primary-Revoked Pass
Test-Certificate-SSL-Primary-AboutToExpire Pass
Test-Certificate-Token-Decrypting-Secondary-NotFoundInStore NotRun
Test-Certificate-Token-Decrypting-Secondary-IsSelfSigned NotRun
Test-Certificate-Token-Decrypting-Secondary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Decrypting-Secondary-Expired Pass
Test-Certificate-Token-Decrypting-Secondary-Revoked Pass
Test-Certificate-Token-Decrypting-Secondary-AboutToExpire NotRun
Test-Certificate-Token-Signing-Secondary-NotFoundInStore NotRun
Test-Certificate-Token-Signing-Secondary-IsSelfSigned NotRun
Test-Certificate-Token-Signing-Secondary-PrivateKeyAbsent NotRun
Test-Certificate-Token-Signing-Secondary-Expired Pass
Test-Certificate-Token-Signing-Secondary-Revoked Pass
Test-Certificate-Token-Signing-Secondary-AboutToExpire NotRun
CheckFarmDNSHostResolution Pass
CheckDuplicateSPN Pass
TestServiceAccountProperties Pass
TestAppPoolIDMatchesServiceID NotRun
TestComputerNameEqFarmName Pass
TestSSLUsingADFSPort NotRun
TestSSLCertSubjectContainsADFSFarmName Pass
TestAdfsAuditPolicyEnabled Fail
TestAdfsRequestToken Pass
CheckOffice365Endpoints Pass
TestADFSO365RelyingParty NotRun
TestNtlmOnlySupportedClientAtProxyEnabled Fail
Test-AdfsServerHealth | where {$_.Result -eq "Fail"} | fl
Name : Test-Certificate-SSL-Primary-IsSelfSigned
Result : Fail
Detail : SSL certificate with thumbprint 24...35 is self-signed.
Output : {Thumbprint}
ExceptionMessage :
Name : TestAdfsAuditPolicyEnabled
Result : Fail
Detail : Audits are not configured for Usage data collection : Expected 'Success and Failure', Actual='No
Auditing'
Output : {StsAuditConfig, MachineAuditPolicy}
ExceptionMessage :
Name : TestNtlmOnlySupportedClientAtProxyEnabled
Result : Fail
Detail : NtlmOnlySupportedClientAtProxy is disabled; extranet users can experience authentication failure.
Output : {NtlmOnlySupportedClientAtProxy}
ExceptionMessage :
More examples here.
Enjoy!
Wednesday, November 15, 2017
ADFS : ADFS 4.0 with SPA
This is for Server 2016 with a single page application.
There is a sample that shows how to do this but you will see many comments along the lines of "I can authenticate but when I call the API I get "Authorization has been denied for this request" ".
This error is typically invoked when either the "audience" or the "issuer" is wrong.
Id_token content
aud:https://localhost:44326/
iss:https://some-adfs/adfs
Ensure these are the values configured for "Audience" and "Issuer" in the "appSettings".
They are case-sensitive!
The sample is a badly hacked Azure AD one and still has references to this all over the place.
It is also confusing because it refers to constructs like "tenant" which mean nothing in the ADFS world.
Also the clientID is a string (as in Azure AD) rather than a GIUD that is automatically generated for you when you create the application.
It needs to be rewritten to make it ADFS centric!
The other problem is that it uses implicit flow and there are contradictory articles that mention that you cannot get extra or custom claims with this flow because it would make the query string too long?
My understanding is that to get the custom claims, you need to do a POST whereas adal.js does a GET. This requires the claims to be in the URL which is not secure and may make the URL too long.
This is a restriction of adal.js; not a restriction of the protocol.
This post suggests that you can fix the problem by proxying the GET to a POST.
Also of interest is that using the identityserver oidc-client-js stack instead of adal.js does not have have this problem. But then you lose the goodness of ADAL.
Claims rules are a huge part of the advantage of ADFS. It's a pity that they can't be used in this scenario.
Enjoy!
There is a sample that shows how to do this but you will see many comments along the lines of "I can authenticate but when I call the API I get "Authorization has been denied for this request" ".
This error is typically invoked when either the "audience" or the "issuer" is wrong.
Once you have authenticated, look at the token you received under the "User" tab e.g.
aud:https://localhost:44326/
iss:https://some-adfs/adfs
Ensure these are the values configured for "Audience" and "Issuer" in the "appSettings".
They are case-sensitive!
The sample is a badly hacked Azure AD one and still has references to this all over the place.
It is also confusing because it refers to constructs like "tenant" which mean nothing in the ADFS world.
Also the clientID is a string (as in Azure AD) rather than a GIUD that is automatically generated for you when you create the application.
It needs to be rewritten to make it ADFS centric!
The other problem is that it uses implicit flow and there are contradictory articles that mention that you cannot get extra or custom claims with this flow because it would make the query string too long?
My understanding is that to get the custom claims, you need to do a POST whereas adal.js does a GET. This requires the claims to be in the URL which is not secure and may make the URL too long.
This is a restriction of adal.js; not a restriction of the protocol.
This post suggests that you can fix the problem by proxying the GET to a POST.
Also of interest is that using the identityserver oidc-client-js stack instead of adal.js does not have have this problem. But then you lose the goodness of ADAL.
Claims rules are a huge part of the advantage of ADFS. It's a pity that they can't be used in this scenario.
Enjoy!
Monday, November 06, 2017
ADFS : Application Groups
ADFS 4.0 manages OpenID Connect / OAuth connections via the "Application Groups" folder.
There are three kinds:
Examples:
Get-AdfsNativeClientApplication
Name : MyApp - Native application
Identifier : b2...27
ApplicationGroupIdentifier : MyApp
Description :
Enabled : True
RedirectUri : {https://blah}
Get-AdfsServerApplication
ADUserPrincipalName :
ClientSecret : ********
JWTSigningCertificateRevocationCheck : None
JWTSigningKeys : {}
JWKSUri :
Name : My server application
Identifier : 8e...44
ApplicationGroupIdentifier : MyApp
Description :
Enabled : True
RedirectUri : {https://blah}
Get-AdfsWebApiApplication
Name : My Web API
Identifier : {https://blah/webapi}
AccessControlPolicyName : Permit everyone
AccessControlPolicyParameters :
AdditionalAuthenticationRules :
AllowedAuthenticationClassReferences : {}
AllowedClientTypes : Public, Confidential
ApplicationGroupIdentifier : MyApp
ApplicationGroupId : 12...56
AlwaysRequireAuthentication : False
ClaimsProviderName : {}
DelegationAuthorizationRules :
Enabled : True
ImpersonationAuthorizationRules :
IssuanceAuthorizationRules :
IssueOAuthRefreshTokensTo : AllDevices
IssuanceTransformRules : @RuleName = "All"
c:[]
=> issue(claim = c);
NotBeforeSkew : 0
Description :
PublishedThroughProxy : False
RefreshTokenProtectionEnabled : False
RequestMFAFromClaimsProviders : False
ResultantPolicy : RequireFreshAuthentication:False
IssuanceAuthorizationRules:
{
Permit everyone
}
TokenLifetime : 0
Plus we have the legacy cmdlets from ADFS 3.0:
Get-AdfsClient
RedirectUri : {ms-appx-web://Microsoft.AAD.BrokerPlugin}
Name : Windows Logon Client
Description : Client for Microsoft Windows Logon
ClientId : 38...93b
BuiltIn : True
Enabled : True
ClientType : Public
ADUserPrincipalName :
ClientSecret :
JWTSigningCertificateRevocationCheck : None
JWTSigningKeys : {}
JWKSUri :
Just remember that the clientID is auto-generated when you create one of these entries and the secret key can only be viewed once in the wizard during creation.
Plus there was this question over on the forum around scope:
In an ADFS Application Group, add Client Application/Permitted Scope to Web API with PowerShell
Grant-AdfsApplicationPermission -ClientRoleIdentifier $clientAppIdGuid -ServerRoleIdentifier $relyingPartyIdentifier -ScopeNames $theScopesYouWantAssignedTo
And remember you can get all the commands by:
get-command *adfsclient*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsClient 1.0.0.0 ADFS
Cmdlet Disable-AdfsClient 1.0.0.0 ADFS
Cmdlet Enable-AdfsClient 1.0.0.0 ADFS
Cmdlet Get-AdfsClient 1.0.0.0 ADFS
Cmdlet Remove-AdfsClient 1.0.0.0 ADFS
Cmdlet Set-AdfsClient 1.0.0.0 ADFS
get-command *adfsnativeclient*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsNativeClientApplication 1.0.0.0 ADFS
Cmdlet Get-AdfsNativeClientApplication 1.0.0.0 ADFS
Cmdlet Remove-AdfsNativeClientApplication 1.0.0.0 ADFS
Cmdlet Set-AdfsNativeClientApplication 1.0.0.0 ADFS
get-command *adfsserver*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsServerApplication 1.0.0.0 ADFS
Cmdlet Get-AdfsServerApplication 1.0.0.0 ADFS
Cmdlet Remove-AdfsServerApplication 1.0.0.0 ADFS
Cmdlet Set-AdfsServerApplication 1.0.0.0 ADFS
get-command *adfswebapi*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsWebApiApplication 1.0.0.0 ADFS
Cmdlet Get-AdfsWebApiApplication 1.0.0.0 ADFS
Cmdlet Remove-AdfsWebApiApplication 1.0.0.0 ADFS
Cmdlet Set-AdfsWebApiApplication 1.0.0.0 ADFS
get-command *adfsapplication*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Disable-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Enable-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Get-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Get-AdfsApplicationPermission 1.0.0.0 ADFS
Cmdlet Grant-AdfsApplicationPermission 1.0.0.0 ADFS
Cmdlet New-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Remove-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Revoke-AdfsApplicationPermission 1.0.0.0 ADFS
Cmdlet Set-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Set-AdfsApplicationPermission 1.0.0.0 ADFS
Enjoy!
There are three kinds:
- Native application
- Server application
- Web API
- Native application accessing web API
- Server application accessing Web API
- Web browser accessing web application
- Get-AdfsNativeClientApplication
- Get-AdfsServerApplication
- Get-AdfsWebApiApplication
Examples:
Get-AdfsNativeClientApplication
Name : MyApp - Native application
Identifier : b2...27
ApplicationGroupIdentifier : MyApp
Description :
Enabled : True
RedirectUri : {https://blah}
Get-AdfsServerApplication
ADUserPrincipalName :
ClientSecret : ********
JWTSigningCertificateRevocationCheck : None
JWTSigningKeys : {}
JWKSUri :
Name : My server application
Identifier : 8e...44
ApplicationGroupIdentifier : MyApp
Description :
Enabled : True
RedirectUri : {https://blah}
Get-AdfsWebApiApplication
Name : My Web API
Identifier : {https://blah/webapi}
AccessControlPolicyName : Permit everyone
AccessControlPolicyParameters :
AdditionalAuthenticationRules :
AllowedAuthenticationClassReferences : {}
AllowedClientTypes : Public, Confidential
ApplicationGroupIdentifier : MyApp
ApplicationGroupId : 12...56
AlwaysRequireAuthentication : False
ClaimsProviderName : {}
DelegationAuthorizationRules :
Enabled : True
ImpersonationAuthorizationRules :
IssuanceAuthorizationRules :
IssueOAuthRefreshTokensTo : AllDevices
IssuanceTransformRules : @RuleName = "All"
c:[]
=> issue(claim = c);
NotBeforeSkew : 0
Description :
PublishedThroughProxy : False
RefreshTokenProtectionEnabled : False
RequestMFAFromClaimsProviders : False
ResultantPolicy : RequireFreshAuthentication:False
IssuanceAuthorizationRules:
{
Permit everyone
}
TokenLifetime : 0
Plus we have the legacy cmdlets from ADFS 3.0:
Get-AdfsClient
RedirectUri : {ms-appx-web://Microsoft.AAD.BrokerPlugin}
Name : Windows Logon Client
Description : Client for Microsoft Windows Logon
ClientId : 38...93b
BuiltIn : True
Enabled : True
ClientType : Public
ADUserPrincipalName :
ClientSecret :
JWTSigningCertificateRevocationCheck : None
JWTSigningKeys : {}
JWKSUri :
Just remember that the clientID is auto-generated when you create one of these entries and the secret key can only be viewed once in the wizard during creation.
Plus there was this question over on the forum around scope:
In an ADFS Application Group, add Client Application/Permitted Scope to Web API with PowerShell
Grant-AdfsApplicationPermission -ClientRoleIdentifier $clientAppIdGuid -ServerRoleIdentifier $relyingPartyIdentifier -ScopeNames $theScopesYouWantAssignedTo
And remember you can get all the commands by:
get-command *adfsclient*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsClient 1.0.0.0 ADFS
Cmdlet Disable-AdfsClient 1.0.0.0 ADFS
Cmdlet Enable-AdfsClient 1.0.0.0 ADFS
Cmdlet Get-AdfsClient 1.0.0.0 ADFS
Cmdlet Remove-AdfsClient 1.0.0.0 ADFS
Cmdlet Set-AdfsClient 1.0.0.0 ADFS
get-command *adfsnativeclient*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsNativeClientApplication 1.0.0.0 ADFS
Cmdlet Get-AdfsNativeClientApplication 1.0.0.0 ADFS
Cmdlet Remove-AdfsNativeClientApplication 1.0.0.0 ADFS
Cmdlet Set-AdfsNativeClientApplication 1.0.0.0 ADFS
get-command *adfsserver*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsServerApplication 1.0.0.0 ADFS
Cmdlet Get-AdfsServerApplication 1.0.0.0 ADFS
Cmdlet Remove-AdfsServerApplication 1.0.0.0 ADFS
Cmdlet Set-AdfsServerApplication 1.0.0.0 ADFS
get-command *adfswebapi*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-AdfsWebApiApplication 1.0.0.0 ADFS
Cmdlet Get-AdfsWebApiApplication 1.0.0.0 ADFS
Cmdlet Remove-AdfsWebApiApplication 1.0.0.0 ADFS
Cmdlet Set-AdfsWebApiApplication 1.0.0.0 ADFS
get-command *adfsapplication*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Disable-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Enable-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Get-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Get-AdfsApplicationPermission 1.0.0.0 ADFS
Cmdlet Grant-AdfsApplicationPermission 1.0.0.0 ADFS
Cmdlet New-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Remove-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Revoke-AdfsApplicationPermission 1.0.0.0 ADFS
Cmdlet Set-AdfsApplicationGroup 1.0.0.0 ADFS
Cmdlet Set-AdfsApplicationPermission 1.0.0.0 ADFS
Enjoy!
Subscribe to:
Posts (Atom)