Skip to content

Instantly share code, notes, and snippets.

@explorer14
Last active January 12, 2021 21:15
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 explorer14/24a4571ee80c7bdd9c071590e38348e4 to your computer and use it in GitHub Desktop.
Save explorer14/24a4571ee80c7bdd9c071590e38348e4 to your computer and use it in GitHub Desktop.
public static IServiceCollection AddTraxpenseAuthentication(
this IServiceCollection services)
{
// register the framework service for auth
services.AddAuthorizationCore();
// register custom dependencies
services.AddSingleton<IClientTokenStorage, SessionTokenStorage>();
services.AddScoped<AuthenticationStateProvider>(
serviceProvider =>
new MyAuthenticationStateProvider(
serviceProvider.GetService<IAuthenticationService>(),
serviceProvider.GetService<IClientTokenStorage>()));
services.AddScoped<IAuthenticationService, AuthenticationService>();
return services;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment