Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting logs "information" to "debug" #99

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/Medidata.MAuth.Core/MAuthAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task<bool> AuthenticateRequest(HttpRequestMessage request)
{
try
{
_logger.LogInformation("Initiating Authentication of the request.");
_logger.LogDebug("Initiating Authentication of the request.");

var authHeader = request.GetAuthHeaderValue();
var version = authHeader.GetVersionFromAuthenticationHeader();
Expand Down Expand Up @@ -103,9 +103,12 @@ public async Task<bool> AuthenticateRequest(HttpRequestMessage request)

private async Task<bool> Authenticate(HttpRequestMessage request, MAuthVersion version, Guid signedAppUuid)
{
var logMessage = "Mauth-client attempting to authenticate request from app with mauth app uuid " +
$"{signedAppUuid} to app with mauth app uuid {_options.ApplicationUuid} using version {version}";
_logger.LogInformation(logMessage);
_logger.LogDebug(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only one that maybe we want to keep, I'd like to hear from @danielloganking , @johnduhart or other dotnet practicioners

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be @lyndon-gabriel , @dcassidy-mdsol has to say anything ?

"Mauth-client attempting to authenticate request from app with mauth app uuid "+
"{signedAppUuid} to app with mauth app uuid {_options.ApplicationUuid} using version {version}",
signedAppUuid,
_options.ApplicationUuid,
version);

var mAuthCore = MAuthCoreFactory.Instantiate(version);
var authInfo = GetAuthenticationInfo(request, mAuthCore);
Expand Down Expand Up @@ -144,9 +147,10 @@ private bool IsSignatureTimeValid(DateTimeOffset signedTime)

private async Task<CacheResult<ApplicationInfo>> SendApplicationInfoRequest(Guid applicationUuid)
{
var logMessage = "Mauth-client requesting from mAuth service application info not available " +
$"in the local cache for app uuid {applicationUuid}.";
_logger.LogInformation(logMessage);
_logger.LogDebug(
"Mauth-client requesting from mAuth service application info not available " +
"in the local cache for app uuid {applicationUuid}.",
applicationUuid);

var retrier = new MAuthRequestRetrier(_lazyHttpClient.Value);
var response = await retrier.GetSuccessfulResponse(
Expand All @@ -157,8 +161,9 @@ private async Task<CacheResult<ApplicationInfo>> SendApplicationInfoRequest(Guid

var result = await response.Content.FromResponse().ConfigureAwait(false);

logMessage = $"Mauth-client application info for app uuid {applicationUuid} cached in memory.";
_logger.LogInformation(logMessage);
_logger.LogDebug(
"Mauth-client application info for app uuid {applicationUuid} cached in memory.",
applicationUuid);

var cacheResult = new CacheResult<ApplicationInfo>
{
Expand Down