Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces testauthenvironment.json for defining roles, users, apps, …
…and role assignments. (#90)
- Loading branch information
1 parent
9ee4357
commit 664361e
Showing
22 changed files
with
406 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<# | ||
.SYNOPSIS | ||
Turns an object read from an ASP.NET core JSON config file into a hashtable where each leaf value (string/int/bool) of the input object is added as a value in the hash table with the path to the value as the key. | ||
.EXAMPLE | ||
ConvertTo-FlattenedConfigurationHashtable.ps1 -InputObject (ConvertFrom-Json '{ "pets" : [ { "name": "Garfield" }, { "name": "Odie" } ] }') -PathPrefix "resource" | ||
Returns: | ||
Name Value | ||
---- ----- | ||
resource:pets:0:name Garfield | ||
resource:pets:1:name Odie | ||
.PARAMETER InputObject | ||
The the deserialized JSON configuration object. | ||
.PARAMETER PathPrefix | ||
A path prefix to include in all paths | ||
#> | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
$InputObject, | ||
|
||
[Parameter(Mandatory = $false)] | ||
$PathPrefix = "" | ||
) | ||
|
||
function Flatten ($Prefix, $Object) { | ||
|
||
if ($Object -is [System.Management.Automation.PSCustomObject]) { | ||
$Object.psobject.properties | ForEach-Object { | ||
Flatten -Prefix "$Prefix$(if ($Prefix) { ":" })$($_.Name)" -Object $_.Value | ||
} | ||
|
||
return | ||
} | ||
|
||
if ($Object -is [object[]]) { | ||
for ($i = 0; $i -lt $Object.Length; $i++) { | ||
Flatten -Prefix "$Prefix$(if ($Prefix) { ":" })$i" -Object $Object[$i] | ||
} | ||
|
||
return | ||
} | ||
|
||
@{$Prefix = $Object} | ||
} | ||
|
||
@(Flatten -Prefix $PathPrefix -Object $InputObject) | ForEach-Object { $hash = @{} } { $hash += $_ } { $hash } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Microsoft.Health.Fhir.Tests.Common/EnvironmentVariables.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System; | ||
|
||
namespace Microsoft.Health.Fhir.Tests.Common | ||
{ | ||
public static class EnvironmentVariables | ||
{ | ||
public static string GetEnvironmentVariableWithDefault(string environmentVariableName, string defaultValue) | ||
{ | ||
var environmentVariable = Environment.GetEnvironmentVariable(environmentVariableName); | ||
|
||
return string.IsNullOrWhiteSpace(environmentVariable) ? defaultValue : environmentVariable; | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Microsoft.Health.Fhir.Web/DevelopmentIdentityProviderApplicationConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Health.Fhir.Web | ||
{ | ||
public class DevelopmentIdentityProviderApplicationConfiguration | ||
{ | ||
public string Id { get; set; } | ||
|
||
public IList<string> Roles { get; set; } = new List<string>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.