ClaimSet Sınıf
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
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. |