本文整理汇总了C#中IApplicationBuilder.UseIdentityServer方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.UseIdentityServer方法的具体用法?C# IApplicationBuilder.UseIdentityServer怎么用?C# IApplicationBuilder.UseIdentityServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplicationBuilder
的用法示例。
在下文中一共展示了IApplicationBuilder.UseIdentityServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
// Does not work with HTTPS
//app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseIdentity();
app.UseIdentityServer();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
示例2: Configure
public void Configure(IApplicationBuilder app, IApplicationEnvironment env, ILoggerFactory loggerFactory)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.CreateLogger();
loggerFactory.AddConsole();
loggerFactory.AddDebug();
app.UseIISPlatformHandler();
var certFile = env.ApplicationBasePath + $"{System.IO.Path.DirectorySeparatorChar}idsrv3test.pfx";
var idsrvOptions = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get()),
SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
RequireSsl = false
};
app.UseIdentityServer(idsrvOptions);
}
示例3: Configure
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Trace);
loggerFactory.AddDebug(LogLevel.Trace);
app.UseDeveloperExceptionPage();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = "Temp",
AutomaticAuthenticate = false,
AutomaticChallenge = false
});
app.UseGoogleAuthentication(new GoogleOptions
{
AuthenticationScheme = "Google",
SignInScheme = "Temp",
ClientId = "434483408261-55tc8n0cs4ff1fe21ea8df2o443v2iuc.apps.googleusercontent.com",
ClientSecret = "3gcoTrEDPPJ0ukn_aYYT6PWo"
});
app.UseIdentityServer();
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
示例4: Configure
public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
{
app.UseIISPlatformHandler();
app.UseDeveloperExceptionPage();
app.UseIdentity();
var certFile = env.ApplicationBasePath + "\\damienbodserver.pfx";
var idsrvOptions = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get()),
SigningCertificate = new X509Certificate2(certFile, ""),
AuthenticationOptions = new AuthenticationOptions
{
EnablePostSignOutAutoRedirect = true
}
};
app.UseIdentityServer(idsrvOptions);
}
示例5: Configure
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Verbose);
loggerFactory.AddDebug(LogLevel.Verbose);
app.UseDeveloperExceptionPage();
app.UseIISPlatformHandler();
app.UseIdentityServer();
app.UseCookieAuthentication(options =>
{
options.AuthenticationScheme = "External";
});
app.UseGoogleAuthentication(options =>
{
options.AuthenticationScheme = "Google";
options.SignInScheme = "External";
options.ClientId = Configuration["GoogleIdentityProvider:ClientId"];
options.ClientSecret = Configuration["GoogleIdentityProvider:ClientSecret"];
options.CallbackPath = new PathString("/googlecallback");
});
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
示例6: Configure
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Verbose);
loggerFactory.AddDebug(LogLevel.Verbose);
app.UseStaticFiles();
app.UseIdentityServer();
}
示例7: Configure
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
{
app.UseIISPlatformHandler();
app.UseDeveloperExceptionPage();
app.UseCors("corsGlobalPolicy");
var certFile = env.ApplicationBasePath + "\\cert.pfx";
var idsrvOptions = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get()),
SigningCertificate = new X509Certificate2(certFile, "christus"),
AuthenticationOptions = new AuthenticationOptions
{
EnablePostSignOutAutoRedirect = true
},
LoggingOptions = new LoggingOptions
{
EnableHttpLogging = true,
EnableWebApiDiagnostics = true,
WebApiDiagnosticsIsVerbose = true
},
};
app.UseIdentityServer(idsrvOptions);
}
示例8: Configure
public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
{
app.UseIISPlatformHandler();
app.UseDeveloperExceptionPage();
app.UseIdentity();
app.UseIdentityServer();
}
示例9: Configure
public void Configure(IApplicationBuilder app)
{
var idsrvOptions = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get()),
};
app.UseIdentityServer(idsrvOptions);
}
示例10: Configure
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Verbose);
loggerFactory.AddDebug(LogLevel.Verbose);
app.UseDeveloperExceptionPage();
app.UseIISPlatformHandler();
app.UseIdentityServer();
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
示例11: Configure
public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
{
var certFile = env.ApplicationBasePath + "\\idsrv3test.pfx";
var idsrvOptions = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get()),
SigningCertificate = new X509Certificate2(certFile, "idsrv3test")
};
app.UseIdentityServer(idsrvOptions);
}
示例12: Configure
public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
{
app.UseIISPlatformHandler();
var certFile = env.ApplicationBasePath + $"{System.IO.Path.DirectorySeparatorChar}idsrv3test.pfx";
var idsrvOptions = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get()),
SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
RequireSsl = false,
};
app.UseIdentityServer(idsrvOptions);
}
示例13: Configure
public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
{
var certFile = Path.Combine(env.ApplicationBasePath, "idsrv3test.pfx");
var factory = IdSvr.Factory.Configure();
var idsrvOptions = new IdentityServerOptions
{
Factory = factory,
SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
RequireSsl = false
};
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
});
app.UseIdentityServer(idsrvOptions);
}
示例14: Configure
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IApplicationEnvironment env, ILoggerFactory loggerFactory,
ScopeConfigurationContext scopeContext, ClientConfigurationContext clientContext)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIISPlatformHandler();
app.UseStaticFiles();
X509Certificate2 certificate = null;
var certFile = env.ApplicationBasePath + $"{System.IO.Path.DirectorySeparatorChar}idsrv3test.pfx";
certificate = new X509Certificate2(certFile, "idsrv3test", X509KeyStorageFlags.MachineKeySet);
var factory = new IdentityServerServiceFactory();
factory.ConfigureEntityFramework(app.ApplicationServices)
.RegisterOperationalStores<OperationalContext>()
.RegisterClientStore<Guid, ClientConfigurationContext>()
.RegisterScopeStore<Guid, ScopeConfigurationContext>();
factory.UseInMemoryUsers(Users.Get());
var idsvrOptions = new IdentityServerOptions
{
SiteName = "Sample Site",
Factory = factory,
SigningCertificate = certificate,
RequireSsl = false
};
app.UseIdentityServer(idsvrOptions);
var scopeinit = new ScopeConfigurationInitializer(scopeContext);
var clientinit = new ClientConfigurationInitializer(clientContext);
scopeinit.InitializeData();
clientinit.InitializeData();
}
示例15: Configure
public void Configure(IApplicationBuilder app)
{
if (CookieAuthenticationScheme != null)
{
app.UseCookieAuthentication(options =>
{
options.AuthenticationScheme = CookieAuthenticationScheme;
});
}
app.UseIdentityServer();
app.Map(Constants.RoutePaths.Login.EnsureLeadingSlash(), path =>
{
path.Run(ctx => Login(ctx));
});
app.Map(Constants.RoutePaths.Consent.EnsureLeadingSlash(), path =>
{
path.Run(ctx => Consent(ctx));
});
app.Map(Constants.RoutePaths.Error.EnsureLeadingSlash(), path =>
{
path.Run(ctx => Error(ctx));
});
}