From 7048a9f8ed1fa596b691eb0c74977edb89522a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jano=C5=A1=C3=ADk?= Date: Wed, 30 Aug 2017 11:34:26 +0200 Subject: [PATCH] Renames ActiveAuthenticationSchemes to AuthenticationSchemes. --- .../Runtime/Filters/AuthorizeAttribute.cs | 11 +++++------ .../ComplexSamples/Auth/AuthorizedPresenter.cs | 2 +- .../ComplexSamples/Auth/SecuredPageViewModel.cs | 4 ++-- .../ComplexSamples/SPARedirect/HomeViewModel.cs | 3 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/DotVVM.Framework.Hosting.AspNetCore/Runtime/Filters/AuthorizeAttribute.cs b/src/DotVVM.Framework.Hosting.AspNetCore/Runtime/Filters/AuthorizeAttribute.cs index 1c3d697686..6d9bf7a424 100644 --- a/src/DotVVM.Framework.Hosting.AspNetCore/Runtime/Filters/AuthorizeAttribute.cs +++ b/src/DotVVM.Framework.Hosting.AspNetCore/Runtime/Filters/AuthorizeAttribute.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Security.Claims; @@ -14,7 +13,7 @@ namespace DotVVM.Framework.Runtime.Filters { /// - /// Recognizes filters and applies a specific . + /// Specifies that the class or method requires the specified authorization. /// public class AuthorizeAttribute : ActionFilterAttribute { @@ -28,7 +27,8 @@ public AuthorizeAttribute() } /// - /// Initializes a new instance of the class with the specified policy. + /// Initializes a new instance of the class with the + /// specified policy. /// /// The name of the policy to require for authorization. public AuthorizeAttribute(string policy) @@ -49,8 +49,7 @@ public AuthorizeAttribute(string policy) /// /// Gets or sets a comma delimited list of schemes from which user information is constructed. /// - public string ActiveAuthenticationSchemes { get; set; } - + public string AuthenticationSchemes { get; set; } /// protected override Task OnViewModelCreatedAsync(IDotvvmRequestContext context) @@ -140,7 +139,7 @@ private async Task GetAuthorizationPolicy(IDotvvmRequestCon policyBuilder.RequireRole(trimmedRolesSplit); useDefaultPolicy = false; } - var authTypesSplit = ActiveAuthenticationSchemes?.Split(','); + var authTypesSplit = AuthenticationSchemes?.Split(','); if (authTypesSplit != null && authTypesSplit.Any()) { foreach (var authType in authTypesSplit) diff --git a/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/AuthorizedPresenter.cs b/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/AuthorizedPresenter.cs index 6ad64e5acd..5b1dbd6508 100644 --- a/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/AuthorizedPresenter.cs +++ b/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/AuthorizedPresenter.cs @@ -4,7 +4,7 @@ namespace DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.Auth { - [Authorize(ActiveAuthenticationSchemes = "Scheme1")] + [Authorize(AuthenticationSchemes = "Scheme1")] public class AuthorizedPresenter : IDotvvmPresenter { public async Task ProcessRequest(IDotvvmRequestContext context) diff --git a/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/SecuredPageViewModel.cs b/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/SecuredPageViewModel.cs index 28d2a8bce5..d20c719405 100644 --- a/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/SecuredPageViewModel.cs +++ b/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/Auth/SecuredPageViewModel.cs @@ -3,7 +3,7 @@ namespace DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.Auth { - [Authorize(ActiveAuthenticationSchemes = "Scheme1")] + [Authorize(AuthenticationSchemes = "Scheme1")] public class SecuredPageViewModel : DotvvmViewModelBase { private static string Message = "server: Hello!"; @@ -17,7 +17,7 @@ public SecuredPageViewModel() public string LastMessage { get; set; } - [Authorize(Roles = "admin", ActiveAuthenticationSchemes = "Scheme1")] + [Authorize(Roles = "admin", AuthenticationSchemes = "Scheme1")] public void ReplaceMessage() { Message = LastMessage = string.Format("{0}: {1}", diff --git a/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/SPARedirect/HomeViewModel.cs b/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/SPARedirect/HomeViewModel.cs index 9dc0e1a820..8c12e2579e 100644 --- a/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/SPARedirect/HomeViewModel.cs +++ b/src/DotVVM.Samples.BasicSamples.AspNetCore/ViewModels/ComplexSamples/SPARedirect/HomeViewModel.cs @@ -2,11 +2,10 @@ using DotVVM.Framework.Hosting; using DotVVM.Framework.Runtime.Filters; using DotVVM.Framework.ViewModel; -using Microsoft.AspNetCore.Authentication; namespace DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.SPARedirect { - [Authorize(ActiveAuthenticationSchemes = "Scheme2")] + [Authorize(AuthenticationSchemes = "Scheme2")] public class HomeViewModel : DotvvmViewModelBase { public async Task SignOut()