Last active
May 24, 2023 20:13
-
-
Save conwid/bfcef34c9763977cc079982b4f9f1a99 to your computer and use it in GitHub Desktop.
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
Demo showing how to hook up custom callbacks for token creation and validation. |
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
public class CustomAuthenticationEvents : CookieAuthenticationEvents | |
{ | |
public override async Task SigningIn(CookieSigningInContext context) | |
{ | |
await base.SigningIn(context); | |
} | |
public async override Task SigningOut(CookieSigningOutContext context) | |
{ | |
await base.SigningOut(context); | |
} | |
public override async Task ValidatePrincipal(CookieValidatePrincipalContext context) | |
{ | |
//context.RejectPrincipal(); | |
//context.ReplacePrincipal(); | |
await base.ValidatePrincipal(context); | |
} | |
} |
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
builder.Services.AddOptions<CookieAuthenticationOptions>(IdentityConstants.ApplicationScheme) | |
.Configure<ITicketStore>((options, store) => options.SessionStore = store) | |
.Configure<CookieAuthenticationEvents>((options, events) => options.Events = events); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment