Reacting to verbose rename

This commit is contained in:
John Luo 2015-12-06 18:32:28 -08:00
parent f24c35f1a9
commit 4c1943b281
4 changed files with 38 additions and 38 deletions

View File

@ -107,12 +107,12 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.RedirectToEndSessionEndpoint(redirectContext); await Options.Events.RedirectToEndSessionEndpoint(redirectContext);
if (redirectContext.HandledResponse) if (redirectContext.HandledResponse)
{ {
Logger.LogVerbose(1, "RedirectToEndSessionEndpoint.HandledResponse"); Logger.LogDebug(1, "RedirectToEndSessionEndpoint.HandledResponse");
return; return;
} }
else if (redirectContext.Skipped) else if (redirectContext.Skipped)
{ {
Logger.LogVerbose(2, "RedirectToEndSessionEndpoint.Skipped"); Logger.LogDebug(2, "RedirectToEndSessionEndpoint.Skipped");
return; return;
} }
@ -170,7 +170,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
} }
Logger.LogDebug(4, "Entering {0}." + nameof(HandleUnauthorizedAsync), GetType()); Logger.LogTrace(4, "Entering {0}." + nameof(HandleUnauthorizedAsync), GetType());
// order for local RedirectUri // order for local RedirectUri
// 1. challenge.Properties.RedirectUri // 1. challenge.Properties.RedirectUri
@ -181,7 +181,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
{ {
properties.RedirectUri = CurrentUri; properties.RedirectUri = CurrentUri;
} }
Logger.LogDebug(5, "Using properties.RedirectUri for 'local redirect' post authentication: '{0}'.", properties.RedirectUri); Logger.LogTrace(5, "Using properties.RedirectUri for 'local redirect' post authentication: '{0}'.", properties.RedirectUri);
if (_configuration == null && Options.ConfigurationManager != null) if (_configuration == null && Options.ConfigurationManager != null)
{ {
@ -223,12 +223,12 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.RedirectToAuthenticationEndpoint(redirectContext); await Options.Events.RedirectToAuthenticationEndpoint(redirectContext);
if (redirectContext.HandledResponse) if (redirectContext.HandledResponse)
{ {
Logger.LogVerbose(6, "RedirectToAuthenticationEndpoint.HandledResponse"); Logger.LogDebug(6, "RedirectToAuthenticationEndpoint.HandledResponse");
return true; return true;
} }
else if (redirectContext.Skipped) else if (redirectContext.Skipped)
{ {
Logger.LogVerbose(7, "RedirectToAuthenticationEndpoint.Skipped"); Logger.LogDebug(7, "RedirectToAuthenticationEndpoint.Skipped");
return false; return false;
} }
@ -294,7 +294,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
/// <remarks>Uses log id's OIDCH-0000 - OIDCH-0025</remarks> /// <remarks>Uses log id's OIDCH-0000 - OIDCH-0025</remarks>
protected override async Task<AuthenticateResult> HandleRemoteAuthenticateAsync() protected override async Task<AuthenticateResult> HandleRemoteAuthenticateAsync()
{ {
Logger.LogDebug(10, "Entering: {0}." + nameof(HandleRemoteAuthenticateAsync), GetType()); Logger.LogTrace(10, "Entering: {0}." + nameof(HandleRemoteAuthenticateAsync), GetType());
OpenIdConnectMessage message = null; OpenIdConnectMessage message = null;
@ -344,7 +344,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
if (string.IsNullOrEmpty(message.State)) if (string.IsNullOrEmpty(message.State))
{ {
// This wasn't a valid ODIC message, it may not have been intended for us. // This wasn't a valid ODIC message, it may not have been intended for us.
Logger.LogVerbose(11, "message.State is null or empty."); Logger.LogDebug(11, "message.State is null or empty.");
return AuthenticateResult.Failed(Resources.MessageStateIsNullOrEmpty); return AuthenticateResult.Failed(Resources.MessageStateIsNullOrEmpty);
} }
@ -374,11 +374,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
if (_configuration == null && Options.ConfigurationManager != null) if (_configuration == null && Options.ConfigurationManager != null)
{ {
Logger.LogVerbose(14, "Updating configuration"); Logger.LogDebug(14, "Updating configuration");
_configuration = await Options.ConfigurationManager.GetConfigurationAsync(Context.RequestAborted); _configuration = await Options.ConfigurationManager.GetConfigurationAsync(Context.RequestAborted);
} }
Logger.LogDebug(15, "Authorization response received."); Logger.LogTrace(15, "Authorization response received.");
var authorizationResponseReceivedContext = new AuthorizationResponseReceivedContext(Context, Options) var authorizationResponseReceivedContext = new AuthorizationResponseReceivedContext(Context, Options)
{ {
ProtocolMessage = message, ProtocolMessage = message,
@ -387,12 +387,12 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.AuthorizationResponseReceived(authorizationResponseReceivedContext); await Options.Events.AuthorizationResponseReceived(authorizationResponseReceivedContext);
if (authorizationResponseReceivedContext.HandledResponse) if (authorizationResponseReceivedContext.HandledResponse)
{ {
Logger.LogVerbose(16, "AuthorizationResponseReceived.HandledResponse"); Logger.LogDebug(16, "AuthorizationResponseReceived.HandledResponse");
return AuthenticateResult.Success(authorizationResponseReceivedContext.AuthenticationTicket); return AuthenticateResult.Success(authorizationResponseReceivedContext.AuthenticationTicket);
} }
else if (authorizationResponseReceivedContext.Skipped) else if (authorizationResponseReceivedContext.Skipped)
{ {
Logger.LogVerbose(17, "AuthorizationResponseReceived.Skipped"); Logger.LogDebug(17, "AuthorizationResponseReceived.Skipped");
return AuthenticateResult.Success(ticket: null); return AuthenticateResult.Success(ticket: null);
} }
message = authorizationResponseReceivedContext.ProtocolMessage; message = authorizationResponseReceivedContext.ProtocolMessage;
@ -408,7 +408,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
} }
else else
{ {
Logger.LogDebug(18, "Cannot process the message. Both id_token and code are missing."); Logger.LogTrace(18, "Cannot process the message. Both id_token and code are missing.");
return AuthenticateResult.Failed(Resources.IdTokenCodeMissing); return AuthenticateResult.Failed(Resources.IdTokenCodeMissing);
} }
} }
@ -421,7 +421,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
{ {
if (Options.ConfigurationManager != null) if (Options.ConfigurationManager != null)
{ {
Logger.LogVerbose(20, "exception of type 'SecurityTokenSignatureKeyNotFoundException' thrown, Options.ConfigurationManager.RequestRefresh() called."); Logger.LogDebug(20, "exception of type 'SecurityTokenSignatureKeyNotFoundException' thrown, Options.ConfigurationManager.RequestRefresh() called.");
Options.ConfigurationManager.RequestRefresh(); Options.ConfigurationManager.RequestRefresh();
} }
} }
@ -465,7 +465,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
var code = authorizationCodeReceivedContext.Code; var code = authorizationCodeReceivedContext.Code;
// Redeeming authorization code for tokens // Redeeming authorization code for tokens
Logger.LogDebug(21, "Id Token is null. Redeeming code '{0}' for tokens.", code); Logger.LogTrace(21, "Id Token is null. Redeeming code '{0}' for tokens.", code);
var tokenEndpointResponse = await RedeemAuthorizationCodeAsync(code, authorizationCodeReceivedContext.RedirectUri); var tokenEndpointResponse = await RedeemAuthorizationCodeAsync(code, authorizationCodeReceivedContext.RedirectUri);
@ -521,7 +521,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
if (Options.GetClaimsFromUserInfoEndpoint) if (Options.GetClaimsFromUserInfoEndpoint)
{ {
Logger.LogDebug(22, "Sending request to user info endpoint for retrieving claims."); Logger.LogTrace(22, "Sending request to user info endpoint for retrieving claims.");
ticket = await GetUserInformationAsync(tokenEndpointResponse, jwt, ticket); ticket = await GetUserInformationAsync(tokenEndpointResponse, jwt, ticket);
} }
@ -531,7 +531,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
// Implicit Flow or Hybrid Flow // Implicit Flow or Hybrid Flow
private async Task<AuthenticateResult> HandleIdTokenFlows(OpenIdConnectMessage message, AuthenticationProperties properties) private async Task<AuthenticateResult> HandleIdTokenFlows(OpenIdConnectMessage message, AuthenticationProperties properties)
{ {
Logger.LogDebug(23, "'id_token' received: '{0}'", message.IdToken); Logger.LogTrace(23, "'id_token' received: '{0}'", message.IdToken);
JwtSecurityToken jwt = null; JwtSecurityToken jwt = null;
var validationParameters = Options.TokenValidationParameters.Clone(); var validationParameters = Options.TokenValidationParameters.Clone();
@ -925,7 +925,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
private async Task<MessageReceivedContext> RunMessageReceivedEventAsync(OpenIdConnectMessage message) private async Task<MessageReceivedContext> RunMessageReceivedEventAsync(OpenIdConnectMessage message)
{ {
Logger.LogDebug(29, "MessageReceived: '{0}'", message.BuildRedirectUrl()); Logger.LogTrace(29, "MessageReceived: '{0}'", message.BuildRedirectUrl());
var messageReceivedContext = new MessageReceivedContext(Context, Options) var messageReceivedContext = new MessageReceivedContext(Context, Options)
{ {
ProtocolMessage = message ProtocolMessage = message
@ -934,11 +934,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.MessageReceived(messageReceivedContext); await Options.Events.MessageReceived(messageReceivedContext);
if (messageReceivedContext.HandledResponse) if (messageReceivedContext.HandledResponse)
{ {
Logger.LogVerbose(30, "MessageReceivedContext.HandledResponse"); Logger.LogDebug(30, "MessageReceivedContext.HandledResponse");
} }
else if (messageReceivedContext.Skipped) else if (messageReceivedContext.Skipped)
{ {
Logger.LogVerbose(31, "MessageReceivedContext.Skipped"); Logger.LogDebug(31, "MessageReceivedContext.Skipped");
} }
return messageReceivedContext; return messageReceivedContext;
@ -948,7 +948,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
{ {
var redirectUri = properties.Items[OpenIdConnectDefaults.RedirectUriForCodePropertiesKey]; var redirectUri = properties.Items[OpenIdConnectDefaults.RedirectUriForCodePropertiesKey];
Logger.LogDebug(32, "AuthorizationCode received: '{0}'", message.Code); Logger.LogTrace(32, "AuthorizationCode received: '{0}'", message.Code);
var authorizationCodeReceivedContext = new AuthorizationCodeReceivedContext(Context, Options) var authorizationCodeReceivedContext = new AuthorizationCodeReceivedContext(Context, Options)
{ {
@ -962,11 +962,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.AuthorizationCodeReceived(authorizationCodeReceivedContext); await Options.Events.AuthorizationCodeReceived(authorizationCodeReceivedContext);
if (authorizationCodeReceivedContext.HandledResponse) if (authorizationCodeReceivedContext.HandledResponse)
{ {
Logger.LogVerbose(33, "AuthorizationCodeReceivedContext.HandledResponse"); Logger.LogDebug(33, "AuthorizationCodeReceivedContext.HandledResponse");
} }
else if (authorizationCodeReceivedContext.Skipped) else if (authorizationCodeReceivedContext.Skipped)
{ {
Logger.LogVerbose(34, "AuthorizationCodeReceivedContext.Skipped"); Logger.LogDebug(34, "AuthorizationCodeReceivedContext.Skipped");
} }
return authorizationCodeReceivedContext; return authorizationCodeReceivedContext;
@ -974,7 +974,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
private async Task<TokenResponseReceivedContext> RunTokenResponseReceivedEventAsync(OpenIdConnectMessage message, OpenIdConnectMessage tokenEndpointResponse) private async Task<TokenResponseReceivedContext> RunTokenResponseReceivedEventAsync(OpenIdConnectMessage message, OpenIdConnectMessage tokenEndpointResponse)
{ {
Logger.LogDebug(35, "Token response received."); Logger.LogTrace(35, "Token response received.");
var tokenResponseReceivedContext = new TokenResponseReceivedContext(Context, Options) var tokenResponseReceivedContext = new TokenResponseReceivedContext(Context, Options)
{ {
ProtocolMessage = message, ProtocolMessage = message,
@ -984,11 +984,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.TokenResponseReceived(tokenResponseReceivedContext); await Options.Events.TokenResponseReceived(tokenResponseReceivedContext);
if (tokenResponseReceivedContext.HandledResponse) if (tokenResponseReceivedContext.HandledResponse)
{ {
Logger.LogVerbose(36, "AuthorizationCodeRedeemedContext.HandledResponse"); Logger.LogDebug(36, "AuthorizationCodeRedeemedContext.HandledResponse");
} }
else if (tokenResponseReceivedContext.Skipped) else if (tokenResponseReceivedContext.Skipped)
{ {
Logger.LogVerbose(37, "AuthorizationCodeRedeemedContext.Skipped"); Logger.LogDebug(37, "AuthorizationCodeRedeemedContext.Skipped");
} }
return tokenResponseReceivedContext; return tokenResponseReceivedContext;
} }
@ -1005,11 +1005,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.AuthenticationValidated(authenticationValidatedContext); await Options.Events.AuthenticationValidated(authenticationValidatedContext);
if (authenticationValidatedContext.HandledResponse) if (authenticationValidatedContext.HandledResponse)
{ {
Logger.LogVerbose(38, "AuthenticationValidated.HandledResponse"); Logger.LogDebug(38, "AuthenticationValidated.HandledResponse");
} }
else if (authenticationValidatedContext.Skipped) else if (authenticationValidatedContext.Skipped)
{ {
Logger.LogVerbose(39, "AuthenticationValidated.Skipped"); Logger.LogDebug(39, "AuthenticationValidated.Skipped");
} }
return authenticationValidatedContext; return authenticationValidatedContext;
@ -1017,7 +1017,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
private async Task<UserInformationReceivedContext> RunUserInformationReceivedEventAsync(AuthenticationTicket ticket, OpenIdConnectMessage message, JObject user) private async Task<UserInformationReceivedContext> RunUserInformationReceivedEventAsync(AuthenticationTicket ticket, OpenIdConnectMessage message, JObject user)
{ {
Logger.LogDebug(40, "User information received: {0}", user.ToString()); Logger.LogTrace(40, "User information received: {0}", user.ToString());
var userInformationReceivedContext = new UserInformationReceivedContext(Context, Options) var userInformationReceivedContext = new UserInformationReceivedContext(Context, Options)
{ {
@ -1029,11 +1029,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.UserInformationReceived(userInformationReceivedContext); await Options.Events.UserInformationReceived(userInformationReceivedContext);
if (userInformationReceivedContext.HandledResponse) if (userInformationReceivedContext.HandledResponse)
{ {
Logger.LogVerbose(41, "The UserInformationReceived event returned Handled."); Logger.LogDebug(41, "The UserInformationReceived event returned Handled.");
} }
else if (userInformationReceivedContext.Skipped) else if (userInformationReceivedContext.Skipped)
{ {
Logger.LogVerbose(42, "The UserInformationReceived event returned Skipped."); Logger.LogDebug(42, "The UserInformationReceived event returned Skipped.");
} }
return userInformationReceivedContext; return userInformationReceivedContext;
@ -1050,11 +1050,11 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
await Options.Events.AuthenticationFailed(authenticationFailedContext); await Options.Events.AuthenticationFailed(authenticationFailedContext);
if (authenticationFailedContext.HandledResponse) if (authenticationFailedContext.HandledResponse)
{ {
Logger.LogVerbose(43, "AuthenticationFailedContext.HandledResponse"); Logger.LogDebug(43, "AuthenticationFailedContext.HandledResponse");
} }
else if (authenticationFailedContext.Skipped) else if (authenticationFailedContext.Skipped)
{ {
Logger.LogVerbose(44, "AuthenticationFailedContext.Skipped"); Logger.LogDebug(44, "AuthenticationFailedContext.Skipped");
} }
return authenticationFailedContext; return authenticationFailedContext;

View File

@ -147,7 +147,7 @@ namespace Microsoft.AspNet.Authentication.Twitter
private async Task<RequestToken> ObtainRequestTokenAsync(string consumerKey, string consumerSecret, string callBackUri, AuthenticationProperties properties) private async Task<RequestToken> ObtainRequestTokenAsync(string consumerKey, string consumerSecret, string callBackUri, AuthenticationProperties properties)
{ {
Logger.LogVerbose("ObtainRequestToken"); Logger.LogDebug("ObtainRequestToken");
var nonce = Guid.NewGuid().ToString("N"); var nonce = Guid.NewGuid().ToString("N");
@ -208,7 +208,7 @@ namespace Microsoft.AspNet.Authentication.Twitter
{ {
// https://dev.twitter.com/docs/api/1/post/oauth/access_token // https://dev.twitter.com/docs/api/1/post/oauth/access_token
Logger.LogVerbose("ObtainAccessToken"); Logger.LogDebug("ObtainAccessToken");
var nonce = Guid.NewGuid().ToString("N"); var nonce = Guid.NewGuid().ToString("N");

View File

@ -216,7 +216,7 @@ namespace Microsoft.AspNet.Authentication
else else
{ {
context.NotAuthenticated(); context.NotAuthenticated();
Logger.LogVerbose(2, "AuthenticationScheme: {scheme} was not authenticated.", Options.AuthenticationScheme); Logger.LogDebug(2, "AuthenticationScheme: {scheme} was not authenticated.", Options.AuthenticationScheme);
} }
} }
} }

View File

@ -52,12 +52,12 @@ namespace Microsoft.AspNet.Authentication
if (context.HandledResponse) if (context.HandledResponse)
{ {
Logger.LogVerbose("The SigningIn event returned Handled."); Logger.LogDebug("The SigningIn event returned Handled.");
return true; return true;
} }
else if (context.Skipped) else if (context.Skipped)
{ {
Logger.LogVerbose("The SigningIn event returned Skipped."); Logger.LogDebug("The SigningIn event returned Skipped.");
return false; return false;
} }