Skip to content

Commit

Permalink
Merge pull request #2204 from unoplatform/dev/nr/webauthlogging
Browse files Browse the repository at this point in the history
feat: Adding logging when unable to launch login or logout flows
  • Loading branch information
nickrandolph authored Mar 15, 2024
2 parents 3c8b4cf + 9619cad commit 2ed91dd
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ private WebAuthenticationSettings InternalSettings
if (loginStartUri is null ||
string.IsNullOrWhiteSpace(loginStartUri))
{
if (ProviderLogger.IsEnabled(LogLevel.Warning))
{
ProviderLogger.LogWarning($"{nameof(InternalSettings.LoginStartUri)} not specified, unable to start login flow");
}
return default;
}

Expand All @@ -68,6 +72,10 @@ private WebAuthenticationSettings InternalSettings

if (string.IsNullOrWhiteSpace(loginCallbackUri))
{
if (ProviderLogger.IsEnabled(LogLevel.Warning))
{
ProviderLogger.LogWarning($"{nameof(InternalSettings.LoginCallbackUri)} not specified and {OAuthRedirectUriParameter} not set in {nameof(InternalSettings.LoginStartUri)}, unable to start login flow");
}
return default;
}

Expand Down Expand Up @@ -153,7 +161,11 @@ protected async override ValueTask<bool> InternalLogoutAsync(IDispatcher? dispat
if (logoutStartUri is null ||
string.IsNullOrWhiteSpace(logoutStartUri))
{
return true;
if (ProviderLogger.IsEnabled(LogLevel.Warning))
{
ProviderLogger.LogWarning($"{nameof(InternalSettings.LogoutStartUri)} not specified, unable to start logout flow");
}
return false;
}

var logoutCallbackUri = InternalSettings.LogoutCallbackUri ?? InternalSettings.LoginCallbackUri;
Expand All @@ -177,6 +189,10 @@ InternalSettings.LoginStartUri is { } loginStartUri &&

if (string.IsNullOrWhiteSpace(logoutCallbackUri))
{
if (ProviderLogger.IsEnabled(LogLevel.Warning))
{
ProviderLogger.LogWarning($"{nameof(InternalSettings.LogoutCallbackUri)} not specified and {OAuthRedirectUriParameter} not set in {nameof(InternalSettings.LogoutStartUri)}, unable to start logout flow");
}
return false;
}

Expand Down

0 comments on commit 2ed91dd

Please sign in to comment.