You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,45 @@
|
||||
// ==++==
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// ==--==
|
||||
// <OWNER>[....]</OWNER>
|
||||
//
|
||||
//
|
||||
// RoleClaimProvider.cs
|
||||
//
|
||||
|
||||
namespace System.Web.Security
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
|
||||
/// <summary>
|
||||
/// This internal class is used to wrap role claims that are served up by the RolePrincipal. They need to be kept distinct from other claims.
|
||||
/// ClaimsIdentity has a property the holds this type.
|
||||
/// made on parameters.
|
||||
/// </summary>
|
||||
|
||||
internal class RoleClaimProvider
|
||||
{
|
||||
RolePrincipal _rolePrincipal;
|
||||
ClaimsIdentity _subject;
|
||||
|
||||
public RoleClaimProvider(RolePrincipal rolePrincipal, ClaimsIdentity subject)
|
||||
{
|
||||
_rolePrincipal = rolePrincipal;
|
||||
_subject = subject;
|
||||
}
|
||||
|
||||
public IEnumerable<Claim> Claims
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (string role in _rolePrincipal.GetRoles())
|
||||
{
|
||||
yield return new Claim(_subject.RoleClaimType, role, ClaimValueTypes.String, _rolePrincipal.ProviderName, _rolePrincipal.ProviderName, _subject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user