-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve user authentication procedure (#125)
* Update the user email if changed in the external login provider * Search for user by Object ID before email address * Add auditing dates to `ApplicationUser` * Track most recent login date * Mask private data when logging
- Loading branch information
1 parent
adc4c39
commit 627dfd8
Showing
12 changed files
with
104 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace MyApp.WebApp.Platform.Logging; | ||
|
||
public static partial class Redaction | ||
{ | ||
public static string MaskEmail(this string? email) | ||
{ | ||
if (string.IsNullOrEmpty(email)) return string.Empty; | ||
|
||
var atIndex = email.IndexOf('@'); | ||
if (atIndex <= 1) return email; | ||
|
||
var maskedEmail = MyRegex().Replace(email[..atIndex], "*"); | ||
return string.Concat(maskedEmail, email.AsSpan(atIndex)); | ||
} | ||
|
||
[GeneratedRegex(".(?=.{2})")] | ||
private static partial Regex MyRegex(); | ||
} |
2 changes: 1 addition & 1 deletion
2
src/WebApp/Platform/ErrorLogging/ShortId.cs → src/WebApp/Platform/Logging/ShortId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.