Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Selectors / KerberosSecurityTokenProvider.cs / 1 / KerberosSecurityTokenProvider.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.IdentityModel.Selectors
{
using System.IdentityModel.Tokens;
using System.Security.Principal;
using System.Net;
public class KerberosSecurityTokenProvider : SecurityTokenProvider
{
string servicePrincipalName;
TokenImpersonationLevel tokenImpersonationLevel;
NetworkCredential networkCredential;
public KerberosSecurityTokenProvider(string servicePrincipalName)
: this(servicePrincipalName, TokenImpersonationLevel.Identification)
{
}
public KerberosSecurityTokenProvider(string servicePrincipalName, TokenImpersonationLevel tokenImpersonationLevel)
: this(servicePrincipalName, tokenImpersonationLevel, null)
{
}
public KerberosSecurityTokenProvider(string servicePrincipalName, TokenImpersonationLevel tokenImpersonationLevel, NetworkCredential networkCredential)
{
if (servicePrincipalName == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("servicePrincipalName");
if (tokenImpersonationLevel != TokenImpersonationLevel.Identification && tokenImpersonationLevel != TokenImpersonationLevel.Impersonation)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("tokenImpersonationLevel",
SR.GetString(SR.ImpersonationLevelNotSupported, tokenImpersonationLevel)));
}
this.servicePrincipalName = servicePrincipalName;
this.tokenImpersonationLevel = tokenImpersonationLevel;
this.networkCredential = networkCredential;
}
public string ServicePrincipalName
{
get { return this.servicePrincipalName; }
}
public TokenImpersonationLevel TokenImpersonationLevel
{
get { return this.tokenImpersonationLevel; }
}
public NetworkCredential NetworkCredential
{
get { return this.networkCredential; }
}
protected override SecurityToken GetTokenCore(TimeSpan timeout)
{
return new KerberosRequestorSecurityToken(this.servicePrincipalName, this.tokenImpersonationLevel, this.networkCredential, SecurityUniqueId.Create().Value);
}
}
}
// 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
- HandleExceptionArgs.cs
- DefaultBinder.cs
- ThreadAbortException.cs
- FileResponseElement.cs
- Permission.cs
- MailSettingsSection.cs
- GeometryDrawing.cs
- ToolboxItem.cs
- PLINQETWProvider.cs
- DataGridViewCellCancelEventArgs.cs
- SerialPort.cs
- FontSizeConverter.cs
- ColorKeyFrameCollection.cs
- NativeRecognizer.cs
- SqlDependencyUtils.cs
- StylusSystemGestureEventArgs.cs
- SqlCommand.cs
- Constraint.cs
- CommandManager.cs
- ContextProperty.cs
- AffineTransform3D.cs
- ListControlConvertEventArgs.cs
- ApplySecurityAndSendAsyncResult.cs
- NonBatchDirectoryCompiler.cs
- HashMembershipCondition.cs
- XmlHierarchyData.cs
- CultureSpecificCharacterBufferRange.cs
- BooleanAnimationBase.cs
- DynamicActivityTypeDescriptor.cs
- HtmlButton.cs
- ConfigurationSectionHelper.cs
- SettingsAttributes.cs
- EmptyEnumerable.cs
- EasingQuaternionKeyFrame.cs
- OdbcEnvironmentHandle.cs
- PathSegment.cs
- _SingleItemRequestCache.cs
- TransactionException.cs
- RuleInfoComparer.cs
- WorkflowMarkupElementEventArgs.cs
- AsyncCompletedEventArgs.cs
- XmlSchemaImport.cs
- DesignerOptionService.cs
- rsa.cs
- DataGridViewRow.cs
- FormatException.cs
- PageThemeParser.cs
- Preprocessor.cs
- AssemblyCollection.cs
- ProjectionPruner.cs
- SystemParameters.cs
- DictionaryBase.cs
- InternalSafeNativeMethods.cs
- AsyncCallback.cs
- TextElementEditingBehaviorAttribute.cs
- SQLByteStorage.cs
- BinarySecretSecurityToken.cs
- ProcessModelSection.cs
- BitVector32.cs
- TraceLog.cs
- ApplicationDirectoryMembershipCondition.cs
- FixedStringLookup.cs
- TextServicesDisplayAttribute.cs
- QuotedStringFormatReader.cs
- HttpApplicationStateWrapper.cs
- ViewStateException.cs
- ReadOnlyDictionary.cs
- ContextMenuStrip.cs
- __Filters.cs
- BindingCompleteEventArgs.cs
- ApplicationDirectory.cs
- ProcessModule.cs
- ProcessHost.cs
- AsymmetricSignatureDeformatter.cs
- XmlCharCheckingReader.cs
- PrimitiveXmlSerializers.cs
- XmlSerializableWriter.cs
- OdbcUtils.cs
- WindowsSysHeader.cs
- CachedRequestParams.cs
- Grant.cs
- DelegateTypeInfo.cs
- PassportAuthentication.cs
- SurrogateEncoder.cs
- BooleanAnimationBase.cs
- Rotation3DAnimation.cs
- CancelEventArgs.cs
- EdmSchemaError.cs
- BaseCollection.cs
- Timer.cs
- HttpWriter.cs
- ToolStripDropTargetManager.cs
- BroadcastEventHelper.cs
- SecureUICommand.cs
- HostingEnvironment.cs
- DocobjHost.cs
- StickyNoteHelper.cs
- MarkupCompilePass1.cs
- BindingSource.cs
- LinkDesigner.cs