Some usefull snippets
services.AddOptions();
services.Configure<ApplicationOption>(
configOptions =>
{
Configuration.GetSection("ConfigStrings").Bind(configOptions.ProviderOptions);
Configuration.GetSection("ConfigStrings").Bind(configOptions.SecretOptions);
Configuration.GetSection("ConfigStrings").Bind(configOptions.AccountOptions);
});
https://andrewlock.net/url-culture-provider-using-middleware-as-mvc-filter-in-asp-net-core-1-1-0/
https://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET
https://www.c-sharpcorner.com/UploadFile/bfb43a/integration-with-slack-using-C-Sharp/
- Startup.cs
- [assembly: OwinStartup(typeof(Startup))] over namespace
public void Configuration(IAppBuilder app)
{
AntiForgeryConfig.UniqueClaimTypeIdentifier = JwtClaimTypes.Name;
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = "https://{authority}.com",
ClientId = "client",
RedirectUri = "https://{redirectUri}:{port}/",
ResponseType = "code id_token token",
SignInAsAuthenticationType = "Cookies",
Scope = "scope scope scope",
Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthorizationCodeReceived = AuthorizationCallback
}
});
}
private Task AuthorizationCallback(AuthorizationCodeReceivedNotification message)
{
// handle sign in
return Task.CompletedTask;
}