[英]How to use Azure AD for authentication for multiple instances of same application
[英]How to use Azure AD authentication with Redis Cache
我創建了一個配置了 Azure AD 的 MVC 應用程序。 因此,所有身份驗證設置都是自動化的。
但我想將用戶會話存儲在 Azure Redis 緩存中。 因為我將使用多個實例
我知道如何在 azure 中設置 redis 緩存。 但是從哪里可以在緩存中添加 Session ?
因為我只有這個代碼
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectUri
});
}
如果要將會話存儲在 redis 中:
Azure Redis 緩存的 ASP.NET 會話狀態提供程序
執行這些步驟后,您的應用程序將配置為使用 Redis 緩存會話狀態提供程序。 在應用程序中使用會話狀態時,它存儲在 Azure Redis 緩存實例中。
如果您想將 redis 用於會話緩存以外的內容:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.