Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Description / ServiceAuthorizationBehavior.cs / 2 / ServiceAuthorizationBehavior.cs
//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------------------
namespace System.ServiceModel.Description
{
using System;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using System.ServiceModel;
using System.Runtime.Serialization;
using System.ServiceModel.Security;
using System.Web.Security;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.IdentityModel.Claims;
using System.IdentityModel.Policy;
using System.Runtime.CompilerServices;
public sealed class ServiceAuthorizationBehavior : IServiceBehavior
{
internal const bool DefaultImpersonateCallerForAllOperations = false;
internal const PrincipalPermissionMode DefaultPrincipalPermissionMode = PrincipalPermissionMode.UseWindowsGroups;
bool impersonateCallerForAllOperations;
ReadOnlyCollection externalAuthorizationPolicies;
ServiceAuthorizationManager serviceAuthorizationManager;
PrincipalPermissionMode principalPermissionMode;
object roleProvider;
bool isExternalPoliciesSet;
bool isAuthorizationManagerSet;
bool isReadOnly;
public ServiceAuthorizationBehavior()
{
this.impersonateCallerForAllOperations = DefaultImpersonateCallerForAllOperations;
this.principalPermissionMode = DefaultPrincipalPermissionMode;
}
ServiceAuthorizationBehavior(ServiceAuthorizationBehavior other)
{
this.impersonateCallerForAllOperations = other.impersonateCallerForAllOperations;
this.principalPermissionMode = other.principalPermissionMode;
this.roleProvider = other.roleProvider;
this.isExternalPoliciesSet = other.isExternalPoliciesSet;
this.isAuthorizationManagerSet = other.isAuthorizationManagerSet;
if (other.isExternalPoliciesSet || other.isAuthorizationManagerSet)
{
CopyAuthorizationPoliciesAndManager(other);
}
this.isReadOnly = other.isReadOnly;
}
public ReadOnlyCollection ExternalAuthorizationPolicies
{
get
{
return this.externalAuthorizationPolicies;
}
set
{
ThrowIfImmutable();
this.isExternalPoliciesSet = true;
this.externalAuthorizationPolicies = value;
}
}
public ServiceAuthorizationManager ServiceAuthorizationManager
{
get
{
return this.serviceAuthorizationManager;
}
set
{
ThrowIfImmutable();
this.isAuthorizationManagerSet = true;
this.serviceAuthorizationManager = value;
}
}
public PrincipalPermissionMode PrincipalPermissionMode
{
get
{
return this.principalPermissionMode;
}
set
{
if (!PrincipalPermissionModeHelper.IsDefined(value))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
ThrowIfImmutable();
this.principalPermissionMode = value;
}
}
public RoleProvider RoleProvider
{
get
{
return (RoleProvider)this.roleProvider;
}
set
{
ThrowIfImmutable();
this.roleProvider = value;
}
}
public bool ImpersonateCallerForAllOperations
{
get
{
return this.impersonateCallerForAllOperations;
}
set
{
ThrowIfImmutable();
this.impersonateCallerForAllOperations = value;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
void ApplyAuthorizationPoliciesAndManager(DispatchRuntime behavior)
{
if (this.externalAuthorizationPolicies != null)
{
behavior.ExternalAuthorizationPolicies = this.externalAuthorizationPolicies;
}
if (this.serviceAuthorizationManager != null)
{
behavior.ServiceAuthorizationManager = this.serviceAuthorizationManager;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
void CopyAuthorizationPoliciesAndManager(ServiceAuthorizationBehavior other)
{
this.externalAuthorizationPolicies = other.externalAuthorizationPolicies;
this.serviceAuthorizationManager = other.serviceAuthorizationManager;
}
[MethodImpl(MethodImplOptions.NoInlining)]
void ApplyRoleProvider(DispatchRuntime behavior)
{
behavior.RoleProvider = (RoleProvider)this.roleProvider;
}
void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase)
{
}
void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collection endpoints, BindingParameterCollection parameters)
{
}
void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
{
if (description == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("description"));
if (serviceHostBase == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("serviceHostBase"));
for (int i=0; i
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AsyncCompletedEventArgs.cs
- OrthographicCamera.cs
- SmiXetterAccessMap.cs
- ArrayElementGridEntry.cs
- QueryOptionExpression.cs
- BindingWorker.cs
- CodeDomConfigurationHandler.cs
- ChineseLunisolarCalendar.cs
- CompensateDesigner.cs
- WebPartVerb.cs
- UriParserTemplates.cs
- TextPointerBase.cs
- BevelBitmapEffect.cs
- LZCodec.cs
- ZipPackage.cs
- SByteStorage.cs
- InputBinding.cs
- DesignerExtenders.cs
- TypeSource.cs
- OutputCache.cs
- PeerNameRecordCollection.cs
- SafeThemeHandle.cs
- StrongNameIdentityPermission.cs
- XmlSchemaSequence.cs
- XmlLanguageConverter.cs
- JoinElimination.cs
- AssemblyCache.cs
- MatrixAnimationUsingKeyFrames.cs
- Base64Encoder.cs
- LinqMaximalSubtreeNominator.cs
- DataSourceSelectArguments.cs
- TransformGroup.cs
- DeviceContext2.cs
- CodeTypeReference.cs
- PriorityQueue.cs
- PerformanceCounters.cs
- WindowInteropHelper.cs
- StateWorkerRequest.cs
- ReachPageContentCollectionSerializerAsync.cs
- CapabilitiesAssignment.cs
- Normalization.cs
- PerfCounters.cs
- TableLayoutStyle.cs
- RuntimeResourceSet.cs
- ImageSource.cs
- BlurEffect.cs
- RequestCachingSection.cs
- ServiceHostingEnvironmentSection.cs
- FixedDocumentPaginator.cs
- OpenTypeLayout.cs
- UnmanagedMarshal.cs
- ResourceType.cs
- EventMap.cs
- WebAdminConfigurationHelper.cs
- CollectionViewGroupRoot.cs
- KeyMatchBuilder.cs
- ZipIOCentralDirectoryBlock.cs
- InternalBufferOverflowException.cs
- FillBehavior.cs
- HtmlControlDesigner.cs
- filewebresponse.cs
- HtmlElementCollection.cs
- Restrictions.cs
- Vector3DConverter.cs
- GcHandle.cs
- EntityContainerEmitter.cs
- Win32Native.cs
- SingleResultAttribute.cs
- InfoCardAsymmetricCrypto.cs
- ReadOnlyDictionary.cs
- KeyTime.cs
- ConfigurationHelpers.cs
- ChildDocumentBlock.cs
- NameValueSectionHandler.cs
- TextPattern.cs
- RootDesignerSerializerAttribute.cs
- ClockGroup.cs
- XmlMapping.cs
- QilInvokeEarlyBound.cs
- ValidatorCompatibilityHelper.cs
- TableLayout.cs
- SubMenuStyle.cs
- HttpModuleCollection.cs
- HebrewCalendar.cs
- Visual.cs
- PathFigure.cs
- ConfigurationValidatorBase.cs
- TextLineBreak.cs
- PeerToPeerException.cs
- CodeTypeOfExpression.cs
- XmlnsDictionary.cs
- ItemCheckEvent.cs
- HealthMonitoringSectionHelper.cs
- DataAdapter.cs
- SHA512Managed.cs
- Point.cs
- CodeGotoStatement.cs
- CleanUpVirtualizedItemEventArgs.cs
- ExceptionUtil.cs
- ServicePerformanceCounters.cs