question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to Set identityOptions ?

See original GitHub issue

Is there any place to access services in order to config identityOptions like this services.Configure<SecurityStampValidatorOptions>(options => { // enables immediate logout, after updating the user's stat. options.ValidationInterval = TimeSpan.Zero; });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
malimingcommented, Jul 25, 2020

Try below code:

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
	AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
	LoginPath = new PathString("/Account/Login"),
	// evaluate for Persistent cookies (IsPermanent == true). Defaults to 14 days when not set.
	ExpireTimeSpan = new TimeSpan(int.Parse(ConfigurationManager.AppSettings["AuthSession.ExpireTimeInDays.WhenPersistent"] ?? "14"), 0, 0, 0),
	SlidingExpiration = bool.Parse(ConfigurationManager.AppSettings["AuthSession.SlidingExpirationEnabled"] ?? bool.FalseString),
	Provider = new CookieAuthenticationProvider
	{
		OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<UserManager, User, long>(
		validateInterval: TimeSpan.FromMinutes(15),
		regenerateIdentityCallback: (manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie),
		getUserIdCallback: claimsIdentity => ClaimsIdentityExtensions.GetUserId(claimsIdentity).Value)
	}
});

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure ASP.NET Core Identity
The IdentityOptions class represents the options that can be used to configure the Identity system. IdentityOptions must be set after ...
Read more >
How to configure IdentityOptions outside ConfigureServices?
I want to configure ASP.NET Core Identity based on settings which resides in database rather than AppSetting.json or hard coded values.
Read more >
IdentityOptions Class (Microsoft.AspNetCore.Identity)
Represents all the options you can use to configure the identity system.
Read more >
Configure ASP.NET Core Identity
AspNetCore.Identity.IdentityOptions class represents the options that can be used to configure the Identity system. xref:Microsoft.AspNetCore.Identity.
Read more >
[.NET Core Identity] How to set option value dynamically ...
Hi everyone. Currently, I need to change parameter value for my IdentityOptions dynamically from db. So, in my ConsigureServices(.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found