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
- WhileDesigner.cs
- FormViewPagerRow.cs
- DeferredReference.cs
- RuntimeHandles.cs
- SessionStateContainer.cs
- ManagementException.cs
- EditorPartCollection.cs
- MenuCommand.cs
- SpeakInfo.cs
- DataSourceControl.cs
- QueryPrefixOp.cs
- WebPartManager.cs
- TableLayoutCellPaintEventArgs.cs
- UIElementIsland.cs
- DataKeyArray.cs
- ScrollEventArgs.cs
- Ipv6Element.cs
- BitmapEffectGeneralTransform.cs
- DocumentsTrace.cs
- COM2ColorConverter.cs
- IntSecurity.cs
- ConfigErrorGlyph.cs
- CTreeGenerator.cs
- ChildTable.cs
- RegionInfo.cs
- BinaryObjectReader.cs
- SQLRoleProvider.cs
- ScriptControlDescriptor.cs
- GeneralTransform.cs
- MetadataArtifactLoaderCompositeFile.cs
- TextBreakpoint.cs
- XmlDataSourceDesigner.cs
- HtmlTableCell.cs
- WebPartEventArgs.cs
- FileEnumerator.cs
- ObjectSet.cs
- UniqueID.cs
- EmptyStringExpandableObjectConverter.cs
- PolygonHotSpot.cs
- SamlDelegatingWriter.cs
- SqlTypesSchemaImporter.cs
- AppSettingsReader.cs
- ResumeStoryboard.cs
- DBBindings.cs
- XslTransform.cs
- ProcessInputEventArgs.cs
- MenuAutomationPeer.cs
- QueryStoreStatusRequest.cs
- mansign.cs
- ConfigurationException.cs
- ContractComponent.cs
- CaseStatementProjectedSlot.cs
- LinqDataSourceSelectEventArgs.cs
- Header.cs
- VirtualizedContainerService.cs
- TreeNodeStyleCollection.cs
- SystemIPv6InterfaceProperties.cs
- GlyphElement.cs
- HtmlEncodedRawTextWriter.cs
- ClientFormsAuthenticationMembershipProvider.cs
- URLString.cs
- SoapAttributes.cs
- ClientScriptManager.cs
- AdapterSwitches.cs
- PrintPreviewControl.cs
- DescendantOverDescendantQuery.cs
- SymbolEqualComparer.cs
- DockPattern.cs
- _DisconnectOverlappedAsyncResult.cs
- HttpListenerResponse.cs
- FormsAuthenticationUser.cs
- System.Data_BID.cs
- WindowsServiceElement.cs
- TemplateControlBuildProvider.cs
- CompatibleComparer.cs
- WindowsAuthenticationModule.cs
- TextTreeTextNode.cs
- ChannelPool.cs
- SiteMapNodeItemEventArgs.cs
- SkewTransform.cs
- SchemaElementLookUpTable.cs
- CompiledAction.cs
- WebResourceUtil.cs
- TextEffect.cs
- SecurityTokenAttachmentMode.cs
- NameNode.cs
- TypeConstant.cs
- BufferedGraphics.cs
- ProcessInputEventArgs.cs
- MachineKeyConverter.cs
- ServiceOperation.cs
- LinqDataSource.cs
- TransactedBatchContext.cs
- XmlSchema.cs
- AttachedPropertyBrowsableAttribute.cs
- DataGridViewTextBoxColumn.cs
- ExecutionPropertyManager.cs
- HtmlString.cs
- Socket.cs
- TextFindEngine.cs