Skip to content

Commit

Permalink
AdfsWebApiApplication: Fix Multiple AllowedClientTypes Property (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Guardian authored Apr 19, 2023
1 parent 209b081 commit 7ea6ae0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- AdsfWebApiApplication
- Fixed issue when the `AllowedClientTypes` Property had multiple values ([#63](https://github.com/X-Guardian/AdfsDsc/issues/63)])

## [1.3.0] - 2023-03-19

### Fixed
Expand Down
30 changes: 16 additions & 14 deletions Tests/Unit/MSFT_AdfsWebApiApplication.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ try
AccessControlPolicyParameters = $mockAccessControlPolicyParameters
AdditionalAuthenticationRules = 'rule'
AllowedAuthenticationClassReferences = @()
AllowedClientTypes = 'Public'
AllowedClientTypes = 'Public', 'Confidential'
AlwaysRequireAuthentication = $false
ClaimsProviderName = @()
DelegationAuthorizationRules = 'rule'
Expand Down Expand Up @@ -266,7 +266,9 @@ try
AccessControlPolicyParameters = $mockGroupAccessControlPolicyParameters
AdditionalAuthenticationRules = $mockResource.AdditionalAuthenticationRules
AllowedAuthenticationClassReferences = $mockResource.AllowedAuthenticationClassReferences
AllowedClientTypes = $mockResource.AllowedClientTypes
AllowedClientTypes = (
[Microsoft.IdentityServer.Protocols.PolicyStore.AllowedClientTypes]::Public -bor
[Microsoft.IdentityServer.Protocols.PolicyStore.AllowedClientTypes]::Confidential)
AlwaysRequireAuthentication = $mockResource.AlwaysRequireAuthentication
ClaimsProviderName = $mockResource.ClaimsProviderName
DelegationAuthorizationRules = $mockResource.DelegationAuthorizationRules
Expand Down Expand Up @@ -349,9 +351,9 @@ try
}

It 'Should throw the correct exception' {
{ Get-TargetResource @getTargetResourceParameters } | `
{ Get-TargetResource @getTargetResourceParameters } |
Should -Throw ($script:localizedData.GettingResourceErrorMessage -f
$getTargetResourceParameters.Name)
$getTargetResourceParameters.Name)
}
}
}
Expand Down Expand Up @@ -428,9 +430,9 @@ try
}

It 'Should throw the correct exception' {
{ Set-TargetResource @setTargetResourcePresentAGIChangedParameters } | `
{ Set-TargetResource @setTargetResourcePresentAGIChangedParameters } |
Should -Throw ($script:localizedData.RemovingResourceErrorMessage -f
$setTargetResourcePresentAGIChangedParameters.Name)
$setTargetResourcePresentAGIChangedParameters.Name)
}
}

Expand All @@ -440,9 +442,9 @@ try
}

It 'Should throw the correct exception' {
{ Set-TargetResource @setTargetResourcePresentAGIChangedParameters } | `
{ Set-TargetResource @setTargetResourcePresentAGIChangedParameters } |
Should -Throw ($script:localizedData.AddingResourceErrorMessage -f
$setTargetResourcePresentAGIChangedParameters.Name)
$setTargetResourcePresentAGIChangedParameters.Name)
}
}
}
Expand Down Expand Up @@ -484,9 +486,9 @@ try
}

It 'Should throw the correct exception' {
{ Set-TargetResource @setTargetResourceParametersChangedProperty } | `
{ Set-TargetResource @setTargetResourceParametersChangedProperty } |
Should -Throw ($script:localizedData.SettingResourceErrorMessage -f
$setTargetResourceParametersChangedProperty.Name)
$setTargetResourceParametersChangedProperty.Name)
}
}
}
Expand Down Expand Up @@ -515,9 +517,9 @@ try
}

It 'Should throw the correct exception' {
{ Set-TargetResource @setTargetResourceAbsentParameters } | `
{ Set-TargetResource @setTargetResourceAbsentParameters } |
Should -Throw ($script:localizedData.RemovingResourceErrorMessage -f
$setTargetResourceAbsentParameters.Name)
$setTargetResourceAbsentParameters.Name)
}
}
}
Expand Down Expand Up @@ -549,9 +551,9 @@ try
}

It 'Should throw the correct exception' {
{ Set-TargetResource @setTargetResourcePresentParameters } | `
{ Set-TargetResource @setTargetResourcePresentParameters } |
Should -Throw ($script:localizedData.AddingResourceErrorMessage -f
$setTargetResourcePresentParameters.Name)
$setTargetResourcePresentParameters.Name)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function Get-TargetResource
AccessControlPolicyParameters = $AccessControlPolicyParameters
AdditionalAuthenticationRules = $targetResource.AdditionalAuthenticationRules
AlwaysRequireAuthentication = $targetResource.AlwaysRequireAuthentication
AllowedClientTypes = @($targetResource.AllowedClientTypes)
AllowedClientTypes = @($targetResource.AllowedClientTypes.ToString().Split(',').Trim(' '))
AllowedAuthenticationClassReferences = @($targetResource.AllowedAuthenticationClassReferences)
ClaimsProviderName = @($targetResource.ClaimsProviderName)
DelegationAuthorizationRules = $targetResource.DelegationAuthorizationRules
Expand Down

0 comments on commit 7ea6ae0

Please sign in to comment.