-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple profiles (#33)
* Add support for multiple profiles * Tidy up and update JSON schema * Tidy up and configuration validation * Added extra validation healthcheck and tidy up * Todos for config validation and NotImplmentedException for unused options method
- Loading branch information
1 parent
53e788a
commit 71b7b75
Showing
8 changed files
with
357 additions
and
97 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
52 changes: 52 additions & 0 deletions
52
src/Umbraco.Community.AzureSSO/HealthChecks/AzureSSOHealthCheck.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,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Umbraco.Cms.Core.HealthChecks; | ||
|
||
namespace Umbraco.Community.AzureSSO.HealthChecks | ||
{ | ||
[HealthCheck(HealthCheckId, HealthCheckName, Description = "Checks the Azure SSO config to ensure it is valid.", Group = "Configuration")] | ||
public class AzureSSOHealthCheck : HealthCheck | ||
{ | ||
private const string HealthCheckId = "07F7DA0A-D351-4347-92B3-9B607E1D38BB"; | ||
private const string HealthCheckName = "Azure SSO"; | ||
|
||
private AzureSSOConfiguration _configuration; | ||
|
||
public AzureSSOHealthCheck(AzureSSOConfiguration configuration) | ||
{ | ||
_configuration = configuration; | ||
} | ||
|
||
public override async Task<IEnumerable<HealthCheckStatus>> GetStatus() | ||
{ | ||
var statuses = new List<HealthCheckStatus>(); | ||
|
||
if (!_configuration.IsValid()) | ||
{ | ||
// TODO : We really need specific feedback for this to be useful | ||
statuses.Add(new HealthCheckStatus("Configuration Invalid.") | ||
{ | ||
Description = "Check AzureSSO configuration", | ||
ResultType = StatusResultType.Error | ||
}); | ||
} | ||
|
||
if(!statuses.Any()) | ||
{ | ||
statuses.Add(new HealthCheckStatus("Configuration valid.") | ||
{ | ||
ResultType = StatusResultType.Success | ||
}); | ||
} | ||
|
||
return statuses; | ||
} | ||
|
||
public override HealthCheckStatus ExecuteAction(HealthCheckAction action) => new("How did you get here?") | ||
{ | ||
ResultType = StatusResultType.Info | ||
}; | ||
} | ||
} |
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.