dsccommunity / WSManDsc

DSC resources for configuring WS-Management and PowerShell Remoting.
https://dsccommunity.org
MIT License
19 stars 8 forks source link

Certificate multi-matcher #95

Closed lamawithonel closed 3 years ago

lamawithonel commented 3 years ago

Pull Request (PR) description

This PR makes it possible to set multiple values for Issuer and DN (makes them arrays). Setting them as arrays allows a single configuration be used for a wider range of circumstances, such as multi-cloud environments where the issuer might be different in each. To achieve this the Find-Certificate function has been overhauled from a series of if-then-else statements, to something more like a compiler for a Where-Object filter script block. This reduces repetition and complexity, and should make it easier to add additional filter parameters. In cases where multiple matching certificates exist, the final list is sorted based on the array input order to ensure determinism, and the first one is returned.

Care has been taken to ensure all existing tests pass, although some minor modifications were required to add new tests. Several additional tests were added.

This PR also fixes #89 as a separate commit, although those changes have no functional effect.

Additional information in the commit comments.

This Pull Request (PR) fixes the following issues

Task list


This change is Reviewable