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
- RepeaterItemCollection.cs
- FrameworkElementFactory.cs
- BooleanSwitch.cs
- IndexObject.cs
- AddInEnvironment.cs
- ObsoleteAttribute.cs
- EnumUnknown.cs
- WebConfigurationFileMap.cs
- DataGridPagerStyle.cs
- Label.cs
- TableLayoutSettings.cs
- CommandConverter.cs
- Drawing.cs
- BackgroundFormatInfo.cs
- TagMapCollection.cs
- DbConnectionStringBuilder.cs
- HtmlMobileTextWriter.cs
- CommentEmitter.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- EntityCommandDefinition.cs
- FileNotFoundException.cs
- RequestUriProcessor.cs
- UrlPropertyAttribute.cs
- DataGridAddNewRow.cs
- DocumentEventArgs.cs
- OracleConnectionStringBuilder.cs
- ImageList.cs
- InkPresenterAutomationPeer.cs
- EntryIndex.cs
- HierarchicalDataTemplate.cs
- NotifyCollectionChangedEventArgs.cs
- precedingquery.cs
- ChainOfDependencies.cs
- IntSecurity.cs
- FontDifferentiator.cs
- EnumValAlphaComparer.cs
- SingleAnimationUsingKeyFrames.cs
- BindingContext.cs
- FixedSOMTableCell.cs
- ToolStripRendererSwitcher.cs
- XmlWhitespace.cs
- WebPartTransformer.cs
- ConditionCollection.cs
- EnumConverter.cs
- CommandSet.cs
- TypedAsyncResult.cs
- ApplicationBuildProvider.cs
- AmbientValueAttribute.cs
- EventProviderTraceListener.cs
- CombinedTcpChannel.cs
- ParserContext.cs
- TextEndOfSegment.cs
- ProfileSettingsCollection.cs
- DigestComparer.cs
- ObjectSecurityT.cs
- PartitionerStatic.cs
- WindowsSlider.cs
- DateTimeSerializationSection.cs
- ContainerControl.cs
- DesignerCommandAdapter.cs
- TCPListener.cs
- _RequestLifetimeSetter.cs
- CompilerResults.cs
- ScriptingSectionGroup.cs
- RequestTimeoutManager.cs
- UserControlCodeDomTreeGenerator.cs
- UITypeEditors.cs
- ADMembershipUser.cs
- FontStretch.cs
- DataContractSerializerFaultFormatter.cs
- IWorkflowDebuggerService.cs
- DSASignatureFormatter.cs
- BufferedReadStream.cs
- ConstructorNeedsTagAttribute.cs
- dataobject.cs
- FlowDocumentFormatter.cs
- XmlILModule.cs
- ByteArrayHelperWithString.cs
- BindToObject.cs
- TextParagraphProperties.cs
- TypeReference.cs
- ITextView.cs
- DesignerLabelAdapter.cs
- WeakReadOnlyCollection.cs
- MyContact.cs
- NegotiateStream.cs
- WizardStepBase.cs
- PropertyMapper.cs
- ModuleConfigurationInfo.cs
- CursorEditor.cs
- IProvider.cs
- ForwardPositionQuery.cs
- AutomationPatternInfo.cs
- BufferedWebEventProvider.cs
- TransportChannelFactory.cs
- HttpServerVarsCollection.cs
- FileUpload.cs
- WebServiceFaultDesigner.cs
- BookmarkWorkItem.cs
- XsltException.cs