Skip to content

Instantly share code, notes, and snippets.

@casper-rasmussen
Created August 14, 2017 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save casper-rasmussen/1c01780ab0a457a0b8697e499e8328f2 to your computer and use it in GitHub Desktop.
Save casper-rasmussen/1c01780ab0a457a0b8697e499e8328f2 to your computer and use it in GitHub Desktop.
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