Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / IssuedTokenClientElement.cs / 1 / IssuedTokenClientElement.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Collections.Generic;
using System.Configuration;
using System.ServiceModel.Security;
using System.ServiceModel.Channels;
using System.Xml;
using System.Security.Principal;
using System.Security.Cryptography.X509Certificates;
using System.ComponentModel;
using System.Security;
public sealed partial class IssuedTokenClientElement : ConfigurationElement
{
public IssuedTokenClientElement()
{
}
[ConfigurationProperty(ConfigurationStrings.LocalIssuer)]
public IssuedTokenParametersEndpointAddressElement LocalIssuer
{
get { return (IssuedTokenParametersEndpointAddressElement)base[ConfigurationStrings.LocalIssuer]; }
}
[ConfigurationProperty(ConfigurationStrings.LocalIssuerChannelBehaviors, DefaultValue = "")]
[StringValidator(MinLength = 0)]
public string LocalIssuerChannelBehaviors
{
get { return (string)base[ConfigurationStrings.LocalIssuerChannelBehaviors]; }
set
{
if (String.IsNullOrEmpty(value))
{
value = String.Empty;
}
base[ConfigurationStrings.LocalIssuerChannelBehaviors] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.IssuerChannelBehaviors)]
public IssuedTokenClientBehaviorsElementCollection IssuerChannelBehaviors
{
get { return (IssuedTokenClientBehaviorsElementCollection)base[ConfigurationStrings.IssuerChannelBehaviors]; }
}
[ConfigurationProperty(ConfigurationStrings.CacheIssuedTokens, DefaultValue = SpnegoTokenProvider.defaultClientCacheTokens)]
public bool CacheIssuedTokens
{
get { return (bool)base[ConfigurationStrings.CacheIssuedTokens]; }
set { base[ConfigurationStrings.CacheIssuedTokens] = value; }
}
[ConfigurationProperty(ConfigurationStrings.MaxIssuedTokenCachingTime, DefaultValue = SpnegoTokenProvider.defaultClientMaxTokenCachingTimeString)]
[TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[ServiceModelTimeSpanValidator(MinValueString = ConfigurationStrings.TimeSpanZero)]
public TimeSpan MaxIssuedTokenCachingTime
{
get { return (TimeSpan)base[ConfigurationStrings.MaxIssuedTokenCachingTime]; }
set { base[ConfigurationStrings.MaxIssuedTokenCachingTime] = value; }
}
[ConfigurationProperty(ConfigurationStrings.DefaultKeyEntropyMode, DefaultValue = System.ServiceModel.Security.AcceleratedTokenProvider.defaultKeyEntropyMode)]
[ServiceModelEnumValidator(typeof(SecurityKeyEntropyModeHelper))]
public SecurityKeyEntropyMode DefaultKeyEntropyMode
{
get { return (SecurityKeyEntropyMode)base[ConfigurationStrings.DefaultKeyEntropyMode]; }
set { base[ConfigurationStrings.DefaultKeyEntropyMode] = value; }
}
[ConfigurationProperty(ConfigurationStrings.IssuedTokenRenewalThresholdPercentage, DefaultValue = SpnegoTokenProvider.defaultServiceTokenValidityThresholdPercentage)]
[IntegerValidator(MinValue = 0, MaxValue = 100)]
public int IssuedTokenRenewalThresholdPercentage
{
get { return (int)base[ConfigurationStrings.IssuedTokenRenewalThresholdPercentage]; }
set { base[ConfigurationStrings.IssuedTokenRenewalThresholdPercentage] = value; }
}
public void Copy(IssuedTokenClientElement from)
{
if (this.IsReadOnly())
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly)));
}
if (null == from)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from");
}
this.DefaultKeyEntropyMode = from.DefaultKeyEntropyMode;
this.CacheIssuedTokens = from.CacheIssuedTokens;
this.MaxIssuedTokenCachingTime = from.MaxIssuedTokenCachingTime;
this.IssuedTokenRenewalThresholdPercentage = from.IssuedTokenRenewalThresholdPercentage;
#pragma warning suppress 56506 //[....]; from.ElementInformation.Properties[ConfigurationStrings.LocalIssuerIssuedTokenParameters] can never be null (underlying configuration system guarantees)
if (PropertyValueOrigin.Default != from.ElementInformation.Properties[ConfigurationStrings.LocalIssuer].ValueOrigin)
{
this.LocalIssuer.Copy(from.LocalIssuer);
}
#pragma warning suppress 56506 //[....]; from.ElementInformation.Properties[ConfigurationStrings.LocalIssuerChannelBehaviors] can never be null (underlying configuration system guarantees)
if (PropertyValueOrigin.Default != from.ElementInformation.Properties[ConfigurationStrings.LocalIssuerChannelBehaviors].ValueOrigin)
{
this.LocalIssuerChannelBehaviors = from.LocalIssuerChannelBehaviors;
}
#pragma warning suppress 56506 //[....]; from.ElementInformation.Properties[ConfigurationStrings.IssuerChannelBehaviors] can never be null (underlying configuration system guarantees)
if (PropertyValueOrigin.Default != from.ElementInformation.Properties[ConfigurationStrings.IssuerChannelBehaviors].ValueOrigin)
{
foreach (IssuedTokenClientBehaviorsElement element in from.IssuerChannelBehaviors)
{
this.IssuerChannelBehaviors.Add(element);
}
}
}
internal void ApplyConfiguration(IssuedTokenClientCredential issuedToken)
{
if (issuedToken == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuedToken");
}
issuedToken.CacheIssuedTokens = this.CacheIssuedTokens;
issuedToken.DefaultKeyEntropyMode = this.DefaultKeyEntropyMode;
issuedToken.MaxIssuedTokenCachingTime = this.MaxIssuedTokenCachingTime;
issuedToken.IssuedTokenRenewalThresholdPercentage = this.IssuedTokenRenewalThresholdPercentage;
if (PropertyValueOrigin.Default != this.ElementInformation.Properties[ConfigurationStrings.LocalIssuer].ValueOrigin)
{
this.LocalIssuer.Validate();
issuedToken.LocalIssuerAddress = ConfigLoader.LoadEndpointAddress(this.LocalIssuer);
if (!string.IsNullOrEmpty(this.LocalIssuer.Binding))
{
issuedToken.LocalIssuerBinding = ConfigLoader.LookupBinding(this.LocalIssuer.Binding, this.LocalIssuer.BindingConfiguration, this.EvaluationContext);
}
}
if (!string.IsNullOrEmpty(this.LocalIssuerChannelBehaviors))
{
ConfigLoader.LoadChannelBehaviors(this.LocalIssuerChannelBehaviors, this.EvaluationContext, issuedToken.LocalIssuerChannelBehaviors);
}
if (PropertyValueOrigin.Default != this.ElementInformation.Properties[ConfigurationStrings.IssuerChannelBehaviors].ValueOrigin)
{
foreach (IssuedTokenClientBehaviorsElement issuerBehaviorElement in this.IssuerChannelBehaviors)
{
if (!string.IsNullOrEmpty(issuerBehaviorElement.BehaviorConfiguration))
{
KeyedByTypeCollection issuerBehaviors = new KeyedByTypeCollection();
ConfigLoader.LoadChannelBehaviors(issuerBehaviorElement.BehaviorConfiguration, this.EvaluationContext, issuerBehaviors);
issuedToken.IssuerChannelBehaviors.Add(new Uri(issuerBehaviorElement.IssuerAddress), issuerBehaviors);
}
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LocalizedNameDescriptionPair.cs
- SmtpException.cs
- IntegerCollectionEditor.cs
- PermissionSetEnumerator.cs
- StreamResourceInfo.cs
- BookmarkScopeHandle.cs
- PersonalizationProviderHelper.cs
- ScrollViewer.cs
- SqlAggregateChecker.cs
- ManagementExtension.cs
- BuildProvider.cs
- DataGridColumn.cs
- DataControlImageButton.cs
- StateManagedCollection.cs
- PrivilegedConfigurationManager.cs
- ValidationRuleCollection.cs
- LoginUtil.cs
- DataBoundControlAdapter.cs
- sqlnorm.cs
- UnsafeNetInfoNativeMethods.cs
- SspiHelper.cs
- MissingFieldException.cs
- CookielessHelper.cs
- DispatcherProcessingDisabled.cs
- ProvidePropertyAttribute.cs
- recordstate.cs
- CodeEventReferenceExpression.cs
- MulticastNotSupportedException.cs
- XPathMessageFilterElementComparer.cs
- NetTcpSecurityElement.cs
- PingReply.cs
- IFlowDocumentViewer.cs
- UrlUtility.cs
- Environment.cs
- DescriptionAttribute.cs
- VsPropertyGrid.cs
- ReaderContextStackData.cs
- BinaryConverter.cs
- FieldBuilder.cs
- MultipleViewPattern.cs
- SplineKeyFrames.cs
- RoutedEventArgs.cs
- BindingSource.cs
- CodeAccessSecurityEngine.cs
- WindowsTokenRoleProvider.cs
- XPathScanner.cs
- AnnotationStore.cs
- TransformPatternIdentifiers.cs
- wgx_exports.cs
- HttpDictionary.cs
- LineVisual.cs
- Property.cs
- StateDesigner.TransitionInfo.cs
- SQLBoolean.cs
- DetailsViewInsertEventArgs.cs
- SqlTypesSchemaImporter.cs
- BitStack.cs
- ResourcesGenerator.cs
- MethodToken.cs
- Constants.cs
- CqlWriter.cs
- ComplexPropertyEntry.cs
- ContentElement.cs
- OdbcDataAdapter.cs
- _SslSessionsCache.cs
- MetafileHeaderWmf.cs
- SqlServices.cs
- NgenServicingAttributes.cs
- ViewStateModeByIdAttribute.cs
- TextServicesDisplayAttributePropertyRanges.cs
- HostingEnvironmentException.cs
- ScrollChrome.cs
- IdleTimeoutMonitor.cs
- NonceToken.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- EffectiveValueEntry.cs
- RequestCache.cs
- ConfigXmlWhitespace.cs
- EmbossBitmapEffect.cs
- WebPartVerbCollection.cs
- ToolBarButtonClickEvent.cs
- AsnEncodedData.cs
- SoapIgnoreAttribute.cs
- Track.cs
- PersistenceTypeAttribute.cs
- CharacterBufferReference.cs
- XmlSchemaInfo.cs
- Image.cs
- BorderGapMaskConverter.cs
- QueueAccessMode.cs
- SqlCacheDependencyDatabaseCollection.cs
- DesignerAutoFormatStyle.cs
- IdentityModelStringsVersion1.cs
- HandlerMappingMemo.cs
- TitleStyle.cs
- FunctionNode.cs
- HttpsTransportBindingElement.cs
- RelOps.cs
- XmlNodeChangedEventArgs.cs
- HandlerBase.cs