private static void OnSendingHeaders(OnSendingHeadersState state, string authenticationMethod) { AuthenticationHeaderValue challenge = state.Challenge; OwinResponse response = state.Response; OwinRequest request = state.Request; if (response.StatusCode != 401) { return; } if (!IsAuthenticationMethodEnabled(request, authenticationMethod)) { return; } AddChallenge(challenge, response); }
public static bool TryRegisterAddChallengeOnSendingHeaders(AuthenticationHeaderValue challenge, string authenticationMethod, OwinRequest request, OwinResponse response, out string errorMessage) { Action <Action <object>, object> registerOnSendingHeaders = GetRegisterOnSendingHeaders(request); if (registerOnSendingHeaders == null) { errorMessage = "OnSendingHeaders is not available."; return(false); } OnSendingHeadersState state = new OnSendingHeadersState { Challenge = challenge, Response = response, Request = request }; registerOnSendingHeaders((untypedState) => OnSendingHeaders((OnSendingHeadersState)untypedState, authenticationMethod), state); errorMessage = null; return(true); }