Report every sign-in and route JWT sign-in through CustomSignInManager - #4
Merged
Merged
Conversation
gismofx
commented
Sep 26, 2026
Collaborator
- CustomSignInManager reports each sign-in (ISignInReporter): cookie sign-ins via a PasswordSignInAsync override, token sign-ins via the new CheckPasswordByEmailAsync
- Default reporter: an ILogger line on every OS (category CPE.DapperIdentity.SignIn) and, on Windows, an Application-log event under PortGuardian.SignIn (1000 failed, 1001 succeeded); never throws
- Fix: JWT Authenticate checked only the password hash, so a disabled user still got a token; Refresh now refuses a disabled user too
- The vanilla-UI set-up registers CustomSignInManager, so IsEnabled applies there as well
- Tests for the event format, each sign-in outcome, and both JWT endpoints over SQLite
- CustomSignInManager reports each sign-in (ISignInReporter): cookie sign-ins via a PasswordSignInAsync override, token sign-ins via the new CheckPasswordByEmailAsync - Default reporter: an ILogger line on every OS (category CPE.DapperIdentity.SignIn) and, on Windows, an Application-log event under PortGuardian.SignIn (1000 failed, 1001 succeeded); never throws - Fix: JWT Authenticate checked only the password hash, so a disabled user still got a token; Refresh now refuses a disabled user too - The vanilla-UI set-up registers CustomSignInManager, so IsEnabled applies there as well - Tests for the event format, each sign-in outcome, and both JWT endpoints over SQLite
- SignInReportingOptions (DapperIdentity:SignInReporting:UserNames): Hashed (default), Plain or None; successes never carry a name - Usernames cleaned of line breaks and control characters and capped at 256 characters before logging (CodeQL log forging)
| new EventId(attempt.Succeeded ? SignInEventFormat.SucceededId : SignInEventFormat.FailedId, | ||
| attempt.Succeeded ? "SignInSucceeded" : "SignInFailed"), | ||
| "Sign-in {Outcome} for {UserName} from {ClientIp} on {App} via {Path} ({Reason})", | ||
| attempt.Succeeded ? "succeeded" : "failed", SignInEventFormat.UserNameFor(attempt, _userNames), attempt.ClientIp, _appName, attempt.Path, |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.