ClaimSet クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
エンティティに関連付けられている要求のコレクションを表します。
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)
- 継承
-
ClaimSet
- 派生
- 属性
- 実装
例
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
注釈
ClaimSet クラスを作成した後は、変更できません。
要求ベースの承認を使用する場合、特定の種類の要求について ClaimSet の内容を調べることは一般的なタスクです。 特定のクレームが存在する ClaimSet を調べるには、 FindClaims メソッドを使用します。 このメソッドは、 ClaimSetを直接反復処理するよりも優れたパフォーマンスを提供します。
コンストラクター
| 名前 | 説明 |
|---|---|
| ClaimSet() |
ClaimSet クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Count |
派生クラスでオーバーライドされると、この要求セット内の要求の数を取得します。 |
| Issuer |
派生クラスでオーバーライドされると、この ClaimSetを発行したエンティティを取得します。 |
| Item[Int32] |
派生クラスでオーバーライドされると、指定したインデックスの Claim を取得します。 |
| System |
アプリケーションの信頼された発行者を表す ClaimSet オブジェクトを取得します。 |
| Windows |
Windows セキュリティ識別子を含むクレームのセットを取得します。 |
メソッド
| 名前 | 説明 |
|---|---|
| ContainsClaim(Claim, IEqualityComparer<Claim>) |
指定したClaimSet オブジェクトを使用して、指定したClaimがIEqualityComparer<T>に含まれるかどうかを判断します。 |
| ContainsClaim(Claim) | |
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| FindClaims(String, String) |
派生クラスでオーバーライドされると、指定した要求の種類とClaimの権限と一致するClaimSet オブジェクトを検索します。 |
| GetEnumerator() |
派生クラスでオーバーライドされると、IEnumerator<T>内のClaim オブジェクトを列挙するために使用できるClaimSetを取得します。 |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| IEnumerable.GetEnumerator() |
IEnumerator<T>内のClaim オブジェクトを列挙するために使用できるClaimSetを取得します。 |