Skip to content

Commit

Permalink
Renames ActiveAuthenticationSchemes to AuthenticationSchemes.
Browse files Browse the repository at this point in the history
  • Loading branch information
djanosik committed Aug 30, 2017
1 parent 1fca4e7 commit 7048a9f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Security.Claims;
Expand All @@ -14,7 +13,7 @@
namespace DotVVM.Framework.Runtime.Filters
{
/// <summary>
/// Recognizes <see cref="Microsoft.AspNetCore.Authorization.AuthorizeAttribute" /> filters and applies a specific <see cref="AuthorizationPolicy" />.
/// Specifies that the class or method requires the specified authorization.
/// </summary>
public class AuthorizeAttribute : ActionFilterAttribute
{
Expand All @@ -28,7 +27,8 @@ public AuthorizeAttribute()
}

/// <summary>
/// Initializes a new instance of the <see cref="Microsoft.AspNetCore.Authorization.AuthorizeAttribute" /> class with the specified policy.
/// Initializes a new instance of the <see cref="Microsoft.AspNetCore.Authorization.AuthorizeAttribute" /> class with the
/// specified policy.
/// </summary>
/// <param name="policy">The name of the policy to require for authorization.</param>
public AuthorizeAttribute(string policy)
Expand All @@ -49,8 +49,7 @@ public AuthorizeAttribute(string policy)
/// <summary>
/// Gets or sets a comma delimited list of schemes from which user information is constructed.
/// </summary>
public string ActiveAuthenticationSchemes { get; set; }

public string AuthenticationSchemes { get; set; }

/// <inheritdoc />
protected override Task OnViewModelCreatedAsync(IDotvvmRequestContext context)
Expand Down Expand Up @@ -140,7 +139,7 @@ private async Task<AuthorizationPolicy> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!";
Expand All @@ -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}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7048a9f

Please sign in to comment.