ClaimSet Sınıf

Tanım

Bir varlıkla ilişkili talep koleksiyonunu temsil eder.

public ref class ClaimSet abstract : System::Collections::Generic::IEnumerable<System::IdentityModel::Claims::Claim ^>
public abstract class ClaimSet : System.Collections.Generic.IEnumerable<System.IdentityModel.Claims.Claim>
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.xmlsoap.org/ws/2005/05/identity")]
public abstract class ClaimSet : System.Collections.Generic.IEnumerable<System.IdentityModel.Claims.Claim>
type ClaimSet = class
    interface seq<Claim>
    interface IEnumerable
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.xmlsoap.org/ws/2005/05/identity")>]
type ClaimSet = class
    interface seq<Claim>
    interface IEnumerable
Public MustInherit Class ClaimSet
Implements IEnumerable(Of Claim)
Devralma
ClaimSet
Türetilmiş
Öznitelikler
Uygulamalar

Örnekler

public class MyServiceAuthorizationManager : ServiceAuthorizationManager
{

    protected override bool CheckAccessCore(OperationContext operationContext)
    {
        // Extract the action URI from the OperationContext. Match this against the claims
        // in the AuthorizationContext.

        string action = operationContext.RequestContext.RequestMessage.Headers.Action;
        Console.WriteLine("action: {0}", action);

        // Iterate through the various claim sets in the AuthorizationContext.
        foreach (ClaimSet cs in operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets)
        {
            // Examine only those claim sets issued by System.
            if (cs.Issuer == ClaimSet.System)
            {
                // Iterate through claims of type "http://example.org/claims/allowedoperation".
                foreach (Claim c in cs.FindClaims("http://example.org/claims/allowedoperation",
                    Rights.PossessProperty))
                {
                    // Write the claim resource to the console.
                    Console.WriteLine("resource: {0}", c.Resource.ToString());

                    // If the claim resource matches the action URI then return true to allow access.
                    if (action == c.Resource.ToString())
                        return true;
                }
            }
        }

        // If this point is reached, return false to deny access.
        return false;
    }
}
Public Class MyServiceAuthorizationManager
    Inherits ServiceAuthorizationManager

    Protected Overrides Function CheckAccessCore(ByVal operationContext As OperationContext) As Boolean

        ' Extract the action URI from the OperationContext. Match this against the claims
        ' in the AuthorizationContext.
        Dim action As String = operationContext.RequestContext.RequestMessage.Headers.Action
        Console.WriteLine("action: {0}", action)

        ' Iterate through the various claim sets in the AuthorizationContext.
        Dim cs As ClaimSet

        For Each cs In operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets
            ' Examine only those claim sets issued by System.
            If cs.Issuer Is ClaimSet.System Then
                ' Iterate through claims of type "http://example.org/claims/allowedoperation".
                Dim c As Claim
                For Each c In cs.FindClaims("http://example.org/claims/allowedoperation", Rights.PossessProperty)
                    ' Write the claim resource to the console.
                    Console.WriteLine("resource: {0}", c.Resource.ToString())

                    ' If the claim resource matches the action URI then return true to allow access
                    If action = c.Resource.ToString() Then
                        Return True
                    End If
                Next c
            End If
        Next cs
        ' 
        ' If this point is reached, return false to deny access.
        Return False

    End Function

Açıklamalar

ClaimSet Sınıf oluşturulduktan sonra değiştirilemez.

Bir talebin ClaimSet içeriğini belirli talep türleri için incelemek, talep tabanlı yetkilendirme kullanılırken sık kullanılan bir görevdir. Belirli taleplerin varlığını incelemek için ClaimSet öğesini FindClaims yöntemi ile kullanın. yöntemi doğrudan üzerinden ClaimSetyinelemekten daha iyi performans sağlar.

Oluşturucular

Name Description
ClaimSet()

ClaimSet sınıfının yeni bir örneğini başlatır.

Özellikler

Name Description
Count

Türetilmiş bir sınıfta geçersiz kılındığında, bu talep kümesindeki talep sayısını alır.

Issuer

Türetilmiş bir sınıfta geçersiz kılındığında, bunu ClaimSetveren varlığı alır.

Item[Int32]

Türetilmiş bir sınıfta geçersiz kılındığında, belirtilen dizin için değerini Claim alır.

System

Uygulamanın güvenilen vereni ClaimSet temsil eden bir nesnesi alır.

Windows

Windows güvenlik tanımlayıcılarını içeren bir dizi talep alır.

Yöntemler

Name Description
ContainsClaim(Claim, IEqualityComparer<Claim>)

belirtilen nesnesini kullanarak öğesinin belirtilen ClaimSetClaim öğesini içerip içermediğini IEqualityComparer<T> belirler.

ContainsClaim(Claim)

öğesinin ClaimSet belirtilen Claimöğesini içerip içermediğini belirler.

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
FindClaims(String, String)

Türetilmiş bir sınıfta geçersiz kılındığında, içinde belirtilen talep türü ve haklarıyla Claimeşleşen bir ClaimSet nesne arar.

GetEnumerator()

Türetilmiş bir sınıfta geçersiz kılındığında, içindeki nesnesini IEnumerator<T>numaralandırmak Claim için kullanılabilecek bir ClaimSet alır.

GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Geçerli örneğin Type alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectbasit bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden bir dize döndürür.

(Devralındığı yer: Object)

Belirtik Arabirim Kullanımları

Name Description
IEnumerable.GetEnumerator()

içindeki IEnumerator<T>nesnesini numaralandırmak Claim için kullanılabilecek bir ClaimSet alır.

Uzantı Metotları

Name Description
ToAsyncEnumerable<TSource>(IEnumerable<TSource>)

bir IEnumerable<T> öğesine IAsyncEnumerable<T>dönüştürür.

ToFrozenDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

Belirtilen anahtar seçici ve öğe seçici işlevlerine göre öğesinden bir FrozenDictionary<TKey,TValue>IEnumerable<T> oluşturur.

ToFrozenDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Belirtilen anahtar seçici işlevine göre işlevinden bir FrozenDictionary<TKey,TValue>IEnumerable<T> oluşturur.

ToFrozenSet<T>(IEnumerable<T>, IEqualityComparer<T>)

Belirtilen değerlerle bir FrozenSet<T> oluşturur.

ToImmutableArray<TSource>(IEnumerable<TSource>)

Belirtilen koleksiyondan sabit bir dizi oluşturur.

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)

Bir diziyi numaralandırır ve dönüştürür ve belirtilen anahtar ve değer karşılaştırıcılarını kullanarak içeriğinin sabit bir sözlüğü oluşturur.

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>)

Bir diziyi numaralandırır ve dönüştürür ve belirtilen anahtar karşılaştırıcıyı kullanarak içeriğinin sabit bir sözlüğü oluşturur.

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

Bir diziyi numaralandırır ve dönüştürür ve içeriğinin sabit bir sözlüğü oluşturur.

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Bir dizideki bazı dönüştürmeleri temel alan sabit bir sözlük oluşturur.

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

Var olan bir öğe koleksiyonundan sabit bir sözlük oluşturur ve kaynak anahtarlara bir dönüştürme işlevi uygular.

ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Bir diziyi numaralandırır, içeriğini sabit bir karma kümesi oluşturur ve küme türü için belirtilen eşitlik karşılaştırıcısını kullanır.

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

Bir diziyi numaralandırır ve içeriğinin sabit bir karma kümesini oluşturur.

ToImmutableList<TSource>(IEnumerable<TSource>)

Bir diziyi numaralandırır ve içeriğinin sabit bir listesini oluşturur.

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>, IEqualityComparer<TValue>)

Bir diziyi numaralandırır ve dönüştürür ve belirtilen anahtar ve değer karşılaştırıcılarını kullanarak içeriğinin sabit bir sıralanmış sözlüğü oluşturur.

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>)

Bir diziyi numaralandırır ve dönüştürür ve belirtilen anahtar karşılaştırıcıyı kullanarak içeriğinin sabit bir sıralanmış sözlüğü oluşturur.

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

Bir diziyi numaralandırır ve dönüştürür ve içeriğinin sabit sıralanabilir bir sözlüğü oluşturur.

ToImmutableSortedSet<TSource>(IEnumerable<TSource>, IComparer<TSource>)

Bir diziyi numaralandırır, içeriğinin sabit bir sıralanmış kümesini oluşturur ve belirtilen karşılaştırıcıyı kullanır.

ToImmutableSortedSet<TSource>(IEnumerable<TSource>)

Bir diziyi numaralandırır ve içindekilerin sabit sıralanabilir bir kümesini oluşturur.

Şunlara uygulanır