Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Selectors / KerberosSecurityTokenProvider.cs / 1305376 / KerberosSecurityTokenProvider.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.IdentityModel.Selectors
{
using System.IdentityModel.Tokens;
using System.Net;
using System.Security.Authentication.ExtendedProtection;
using System.Security.Principal;
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; }
}
internal SecurityToken GetToken(TimeSpan timeout, ChannelBinding channelbinding)
{
return new KerberosRequestorSecurityToken(this.ServicePrincipalName,
this.TokenImpersonationLevel, this.NetworkCredential,
SecurityUniqueId.Create().Value, channelbinding);
}
protected override SecurityToken GetTokenCore(TimeSpan timeout)
{
return this.GetToken(timeout, null);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WindowsEditBoxRange.cs
- CalloutQueueItem.cs
- DbConnectionPoolOptions.cs
- RichTextBoxAutomationPeer.cs
- TrustSection.cs
- AppDomainAttributes.cs
- DataGridViewTextBoxColumn.cs
- DataBoundControlActionList.cs
- ListBox.cs
- SqlConnectionManager.cs
- ValueChangedEventManager.cs
- CfgParser.cs
- DataPagerFieldCollection.cs
- DataGridViewAdvancedBorderStyle.cs
- Select.cs
- isolationinterop.cs
- ToolStripTextBox.cs
- EventMappingSettings.cs
- SemaphoreFullException.cs
- EntitySqlException.cs
- MatrixAnimationUsingPath.cs
- CroppedBitmap.cs
- MemberCollection.cs
- XmlWriterSettings.cs
- EdmPropertyAttribute.cs
- LinqToSqlWrapper.cs
- WriterOutput.cs
- RegexGroup.cs
- DataObjectMethodAttribute.cs
- FlowDocumentReader.cs
- WriteFileContext.cs
- DataListGeneralPage.cs
- ReflectEventDescriptor.cs
- ConnectionPointCookie.cs
- WebPart.cs
- CornerRadiusConverter.cs
- ThicknessConverter.cs
- SQLDouble.cs
- VideoDrawing.cs
- SapiRecognizer.cs
- DispatcherBuilder.cs
- StatusBarItem.cs
- StateBag.cs
- InternalConfigHost.cs
- Itemizer.cs
- TransactionWaitAsyncResult.cs
- SqlCacheDependencyDatabaseCollection.cs
- EventPrivateKey.cs
- ObjectItemNoOpAssemblyLoader.cs
- BufferedGraphicsManager.cs
- UnmanagedHandle.cs
- SafeEventLogWriteHandle.cs
- XomlCompilerError.cs
- NumberFunctions.cs
- infer.cs
- MouseEvent.cs
- SrgsRuleRef.cs
- DataSetSchema.cs
- FunctionDescription.cs
- StyleSheetComponentEditor.cs
- SessionStateContainer.cs
- SimpleWebHandlerParser.cs
- InvokeHandlers.cs
- OrderByBuilder.cs
- FunctionImportElement.cs
- XpsSerializerWriter.cs
- BlurBitmapEffect.cs
- TransformGroup.cs
- HtmlElement.cs
- PasswordTextContainer.cs
- WindowsStatusBar.cs
- CodeAttachEventStatement.cs
- SqlDataSourceAdvancedOptionsForm.cs
- Tablet.cs
- UseAttributeSetsAction.cs
- Types.cs
- DbgCompiler.cs
- SqlDataSourceView.cs
- WinFormsSpinner.cs
- MimeMultiPart.cs
- ProjectedSlot.cs
- XmlStreamStore.cs
- HorizontalAlignConverter.cs
- IndexedString.cs
- Rights.cs
- SafeThemeHandle.cs
- TraceHwndHost.cs
- ConfigXmlComment.cs
- ScriptRef.cs
- NetMsmqSecurityMode.cs
- FormDocumentDesigner.cs
- SpoolingTask.cs
- Italic.cs
- GridView.cs
- XmlStreamNodeWriter.cs
- GroupItemAutomationPeer.cs
- ADMembershipProvider.cs
- CompiledXpathExpr.cs
- PcmConverter.cs
- Column.cs