Microsoft.Identity.Client.AuthenticationParameters.CreateFromUnauthorizedResponseCommon C# (CSharp) Method

CreateFromUnauthorizedResponseCommon() private static method

private static CreateFromUnauthorizedResponseCommon ( IHttpWebResponse response ) : AuthenticationParameters
response IHttpWebResponse
return AuthenticationParameters
        private static AuthenticationParameters CreateFromUnauthorizedResponseCommon(IHttpWebResponse response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            AuthenticationParameters authParams;
            if (response.StatusCode == HttpStatusCode.Unauthorized)
            {
                if (response.Headers.Keys.Contains(AuthenticateHeader))
                {
                    authParams = CreateFromResponseAuthenticateHeader(response.Headers[AuthenticateHeader]);
                }
                else
                {
                    var ex = new ArgumentException(MsalErrorMessage.MissingAuthenticateHeader, "response");
                    PlatformPlugin.Logger.Error(null, ex);
                    throw ex;
                }
            }
            else
            {
                var ex = new ArgumentException(MsalErrorMessage.UnauthorizedHttpStatusCodeExpected, "response");
                PlatformPlugin.Logger.Error(null, ex);
                throw ex;
            }

            return authParams;
        }
    }