/// <summary> /// Handle the challenge /// </summary> /// <param name="challenge"></param> public async Task PrepareChallenge(IChallengeValidationDetails challenge) { if (challenge is TChallenge typed) { _challenge = typed; await PrepareChallenge(); } else { throw new InvalidOperationException("Unexpected challenge type"); } }
/// <summary> /// Handle the challenge /// </summary> /// <param name="challenge"></param> public void PrepareChallenge(IChallengeValidationDetails challenge) { if (challenge.GetType() != typeof(TChallenge)) { throw new InvalidOperationException(); } else { _challenge = (TChallenge)challenge; PrepareChallenge(); } }
public static bool AddChallengeHandling(IServiceProvider services, IChallengeValidationDetails chlngDetails) { var logger = services.GetService <ILogger <AcmeHttp01ChallengeHandler> >(); var state = services.GetService <AcmeState>(); var httpDetails = chlngDetails as Http01ChallengeValidationDetails; if (httpDetails == null) { logger.LogInformation("Unable to handle non-Http01 Challenge details"); return(false); } var fullPath = httpDetails.HttpResourcePath.Trim('/'); logger.LogInformation("Handling Challenges with HTTP full path of [{0}]", fullPath); state.Http01Responses[fullPath] = httpDetails; return(true); }