我有一个与Azure AD B2C连接的Asp.NET MVC应用程序.
在管理员设置中,我创建了一个管理员组:
在我的代码中我想使用 [Authorize(Roles = "Administrator")]
使用常规的Azure Active Directory,它很容易添加(只需3行代码).但对于Azure AD B2C,我找不到任何有用的教程或示例.也许你可以告诉我我需要修改什么.
这是我的Startup.Auth.cs的ConfigureAuth方法
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
// Generate the metadata address using the tenant and policy information
MetadataAddress = String.Format(AadInstance, Tenant, DefaultPolicy),
// These are standard OpenID Connect parameters, with values pulled from web.config
ClientId = ClientId,
RedirectUri = RedirectUri,
PostLogoutRedirectUri = RedirectUri,
// Specify the callbacks for each type of notifications
Notifications = new OpenIdConnectAuthenticationNotifications
{
RedirectToIdentityProvider = …Run Code Online (Sandbox Code Playgroud) 我正在创建一个新的ASP.net Core 2.0 MVC WebApplication.我想导入一个现有的数据库来使用WebApp中的数据.
在ASP.NET MVC 5中有一个简单的方法:只需添加一个新元素:"EF 6.x DbContextGenerator".我发现在ASP.NET Core 2.0中已经消失了.我的以下谷歌搜索没有成功,这就是为什么我问你:ASP.net Core 2.0有没有类似的方式连接到现有的MySQL数据库?
ASP.net Core 2.0中的实体框架是否像ASP.net MVC 5一样工作?