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
- TemplatePropertyEntry.cs
- AttachedAnnotationChangedEventArgs.cs
- ToolStripRenderEventArgs.cs
- LowerCaseStringConverter.cs
- SoapSchemaExporter.cs
- QilValidationVisitor.cs
- TraceHandler.cs
- BitStack.cs
- UIAgentAsyncBeginRequest.cs
- IDictionary.cs
- LocalBuilder.cs
- SqlConnectionPoolGroupProviderInfo.cs
- InitializationEventAttribute.cs
- MailAddressCollection.cs
- RemotingClientProxy.cs
- CqlIdentifiers.cs
- BaseAsyncResult.cs
- StringComparer.cs
- ColumnMapProcessor.cs
- TypeDelegator.cs
- DecoderFallback.cs
- SystemIcons.cs
- MessageBox.cs
- Accessible.cs
- AxParameterData.cs
- UncommonField.cs
- Accessors.cs
- HttpValueCollection.cs
- CapabilitiesPattern.cs
- WindowsBrush.cs
- GlyphRunDrawing.cs
- FrameworkElementFactoryMarkupObject.cs
- EncoderNLS.cs
- DesignTimeHTMLTextWriter.cs
- DocumentApplicationJournalEntry.cs
- DiscoveryReferences.cs
- ServiceReference.cs
- TemplateNameScope.cs
- ApplicationId.cs
- ChunkedMemoryStream.cs
- ImageDrawing.cs
- SizeAnimationUsingKeyFrames.cs
- ModifierKeysConverter.cs
- PeerCollaboration.cs
- TableProviderWrapper.cs
- PropertyOverridesDialog.cs
- ItemsChangedEventArgs.cs
- TextAction.cs
- CodeAttributeArgument.cs
- RegexCharClass.cs
- Int64AnimationUsingKeyFrames.cs
- DefaultBindingPropertyAttribute.cs
- OpCodes.cs
- MessageHeaders.cs
- ListBoxItem.cs
- InvokeHandlers.cs
- ByteKeyFrameCollection.cs
- Simplifier.cs
- BitStack.cs
- HiddenFieldPageStatePersister.cs
- SuppressMergeCheckAttribute.cs
- ExtendedPropertyCollection.cs
- WebPartZoneBase.cs
- Listen.cs
- GeneratedView.cs
- SafeEventLogReadHandle.cs
- NonParentingControl.cs
- RegexCompilationInfo.cs
- CriticalHandle.cs
- ComponentResourceManager.cs
- SessionIDManager.cs
- OdbcParameter.cs
- XPathParser.cs
- MethodCallTranslator.cs
- PersianCalendar.cs
- ExecutionContext.cs
- SettingsContext.cs
- XmlSchemaInfo.cs
- PropertyRef.cs
- ToolStripItemEventArgs.cs
- XmlValidatingReaderImpl.cs
- DoubleIndependentAnimationStorage.cs
- StyleSheetDesigner.cs
- ObjectMemberMapping.cs
- QilFunction.cs
- EntityDataSourceDataSelectionPanel.cs
- ToolstripProfessionalRenderer.cs
- AuthenticationService.cs
- _Rfc2616CacheValidators.cs
- BitStream.cs
- CSharpCodeProvider.cs
- DocumentScope.cs
- SizeLimitedCache.cs
- StdRegProviderWrapper.cs
- CodeAttributeDeclaration.cs
- OdbcErrorCollection.cs
- selecteditemcollection.cs
- UpDownBase.cs
- MimeTypePropertyAttribute.cs
- SimpleBitVector32.cs