-
-
Save casper-rasmussen/1c01780ab0a457a0b8697e499e8328f2 to your computer and use it in GitHub Desktop.
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
class AuthenticationServerHealthCheckConvention : IHealthCheckConvention | |
{ | |
private const string Name = "SSO"; | |
//Dependency to validate | |
private readonly Func<IAuthenticationManager> _authenticationManager; | |
public AuthenticationServerHealthCheckConvention(Func<IAuthenticationManager> authenticationManager) | |
{ | |
this._authenticationManager = authenticationManager; | |
} | |
public void Apply(IHealthCheckConventionManager healthCheckConventionManager) | |
{ | |
bool skip = healthCheckConventionManager.IsHealthCheckIncluded(Name); | |
if (!skip) | |
{ | |
healthCheckConventionManager.IncludeHealthCheck(Name, () => | |
{ | |
//Delegate to execute when requesting a healthcheck | |
//Health check logic goes here. SSO runs if the service is healthy | |
return this._authenticationManager.Invoke().Healthy(); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment