//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Protocols.WSTrust
{
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
///
/// Defines the serialization context class.
///
public class WSTrustSerializationContext
{
private SecurityTokenResolver securityTokenResolver;
private SecurityTokenResolver useKeyTokenResolver;
private SecurityTokenHandlerCollectionManager securityTokenHandlerCollectionManager;
///
/// Initializes an instance
///
public WSTrustSerializationContext()
: this(SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager())
{
}
///
/// Initializes an instance of
///
/// The security token handler collection manager.
public WSTrustSerializationContext(SecurityTokenHandlerCollectionManager securityTokenHandlerCollectionManager)
: this(securityTokenHandlerCollectionManager, EmptySecurityTokenResolver.Instance, EmptySecurityTokenResolver.Instance)
{
}
///
/// Initializes an instance of
///
///
/// The containing the set of
/// objects used for serializing and validating tokens found in WS-Trust messages.
///
///
/// The used to resolve security token references found in most
/// elements of WS-Trust messages.
///
///
/// The used to resolve security token references found in the
/// UseKey element of RST messages as well as the RenewTarget element found in RST messages.
///
public WSTrustSerializationContext(SecurityTokenHandlerCollectionManager securityTokenHandlerCollectionManager, SecurityTokenResolver securityTokenResolver, SecurityTokenResolver useKeyTokenResolver)
{
if (securityTokenHandlerCollectionManager == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("securityTokenHandlerCollectionManager");
}
if (securityTokenResolver == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("securityTokenResolver");
}
if (useKeyTokenResolver == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("useKeyTokenResolver");
}
this.securityTokenHandlerCollectionManager = securityTokenHandlerCollectionManager;
this.securityTokenResolver = securityTokenResolver;
this.useKeyTokenResolver = useKeyTokenResolver;
}
///
/// Gets or sets the used to resolve security token references found in most
/// elements of WS-Trust messages.
///
public SecurityTokenResolver TokenResolver
{
get { return this.securityTokenResolver; }
set { this.securityTokenResolver = value; }
}
///
/// Gets or sets the used to resolve security token references found in the
/// UseKey element of RST messages as well as the RenewTarget element found in RST messages.
///
public SecurityTokenResolver UseKeyTokenResolver
{
get { return this.useKeyTokenResolver; }
set { this.useKeyTokenResolver = value; }
}
///
/// Gets or sets the containing the set of
/// objects used for serializing and validating tokens found in WS-Trust messages.
///
public SecurityTokenHandlerCollectionManager SecurityTokenHandlerCollectionManager
{
get { return this.securityTokenHandlerCollectionManager; }
set { this.securityTokenHandlerCollectionManager = value; }
}
///
/// Gets the collection of objects used to serialize and
/// validate security tokens found in WS-Trust messages.
///
public SecurityTokenHandlerCollection SecurityTokenHandlers
{
get { return this.securityTokenHandlerCollectionManager[SecurityTokenHandlerCollectionManager.Usage.Default]; }
}
}
}