Skip to content

Instantly share code, notes, and snippets.

@MarneeDear
Last active April 19, 2019 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarneeDear/dc49d2c04cbbb61bc4162945164e301b to your computer and use it in GitHub Desktop.
Save MarneeDear/dc49d2c04cbbb61bc4162945164e301b to your computer and use it in GitHub Desktop.
Configure DataProtectionTokenProviderOptions in F# (using Saturn)
//How do I configure the DataProtectionTokenProviderOptions in F#?
//Following the guide here: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.2&tabs=visual-studio#change-email-and-activity-timeout
//This is the code in C#
public void ConfigureServices(IServiceCollection services)
{
services.Configure<DataProtectionTokenProviderOptions>(o =>
o.TokenLifespan = TimeSpan.FromHours(3));
}
//This seems to work
let configService (services:IServiceCollection) =
services.Configure<DataProtectionTokenProviderOptions>(fun (o:DataProtectionTokenProviderOptions) -> o.TokenLifespan <- TimeSpan.FromHours(3.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment