Beispiel #1
0
 public void ConfigureServices(IServiceCollection services)
 {
     services
     .AddBalea(options =>
     {
         options.UnauthorizedFallback = AuthorizationFallbackAction.RedirectToAction("Account", "AccessDenied");
         options.DefaultClaimTypeMap  = new DefaultClaimTypeMap
         {
             PermissionClaimType = "my-name"
         };
     })
     .AddConfigurationStore(Configuration)
     .Services
     .AddAuthentication(configureOptions =>
     {
         configureOptions.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
         configureOptions.DefaultChallengeScheme    = CookieAuthenticationDefaults.AuthenticationScheme;
     })
     .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, setup =>
     {
         setup.LoginPath        = "/Account/Login";
         setup.AccessDeniedPath = "/Account/AccessDenied";
     })
     .Services
     .AddControllersWithViews();
 }
Beispiel #2
0
 public void ConfigureServices(IServiceCollection services)
 {
     services
     .AddBalea(options =>
     {
         //options.SetApplicationName("ContosoUniversity");
         options.UnauthorizedFallback = AuthorizationFallbackAction.RedirectToAction("Account", "AccessDenied");
         options.DefaultClaimTypeMap  = new DefaultClaimTypeMap
         {
             PermissionClaimType = "permissions"
         };
     })
     .AddConfigurationStore(Configuration)
     //.AddApiStore(cfg =>
     //{
     //    cfg.UseApiKey("YynDwPwcxlS6+3gV/p3rCxMGMDDuO+zPc/gI4JA02jU=");
     //    cfg.UseBaseAddress(new System.Uri("https://baleaserverdev.azurewebsites.net"));
     //})
     .Services
     .AddAuthentication(configureOptions =>
     {
         configureOptions.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
         configureOptions.DefaultChallengeScheme    = CookieAuthenticationDefaults.AuthenticationScheme;
     })
     .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, setup =>
     {
         setup.LoginPath        = "/Account/Login";
         setup.AccessDeniedPath = "/Account/AccessDenied";
     })
     .Services
     .AddControllersWithViews();
 }