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
- HtmlContainerControl.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- FixedDocument.cs
- SymLanguageType.cs
- TemplateNameScope.cs
- BinaryNode.cs
- HebrewNumber.cs
- AccessibilityApplicationManager.cs
- coordinator.cs
- BinaryObjectInfo.cs
- OperationAbortedException.cs
- PixelShader.cs
- WindowsScrollBarBits.cs
- CheckBoxFlatAdapter.cs
- ScrollEvent.cs
- XmlMtomWriter.cs
- ButtonFlatAdapter.cs
- CompoundFileStreamReference.cs
- GridViewColumnHeader.cs
- DiagnosticTrace.cs
- SQLBinaryStorage.cs
- diagnosticsswitches.cs
- InOutArgumentConverter.cs
- OptionUsage.cs
- XmlQueryRuntime.cs
- CornerRadiusConverter.cs
- WindowExtensionMethods.cs
- PropertyItem.cs
- SymbolMethod.cs
- DocumentProperties.cs
- StyleCollectionEditor.cs
- ArrangedElement.cs
- Point.cs
- ZipIOExtraFieldPaddingElement.cs
- SystemThemeKey.cs
- ParagraphVisual.cs
- RoutedEventConverter.cs
- GeneralTransform3DTo2D.cs
- ConnectionAcceptor.cs
- ConnectionProviderAttribute.cs
- XmlStringTable.cs
- Descriptor.cs
- Tablet.cs
- SlotInfo.cs
- MetadataPropertyAttribute.cs
- MetadataFile.cs
- TreeViewCancelEvent.cs
- CqlGenerator.cs
- SafePointer.cs
- SEHException.cs
- OleDbMetaDataFactory.cs
- CapabilitiesRule.cs
- BamlRecordHelper.cs
- UrlMapping.cs
- PeerCollaboration.cs
- SecurityAlgorithmSuite.cs
- TraceUtils.cs
- BoolExpr.cs
- EventManager.cs
- PinProtectionHelper.cs
- DelayedRegex.cs
- TimeoutConverter.cs
- EncodingNLS.cs
- FtpCachePolicyElement.cs
- RbTree.cs
- SessionState.cs
- SmtpSection.cs
- AsymmetricKeyExchangeFormatter.cs
- PropertyTabChangedEvent.cs
- ResourceDescriptionAttribute.cs
- Page.cs
- Rect3DValueSerializer.cs
- RelationshipType.cs
- DocumentReference.cs
- ErrorInfoXmlDocument.cs
- ADConnectionHelper.cs
- GlobalItem.cs
- ConstructorNeedsTagAttribute.cs
- CharacterHit.cs
- InternalMappingException.cs
- ReflectionServiceProvider.cs
- SHA256.cs
- EdmProviderManifest.cs
- BindUriHelper.cs
- ItemsControlAutomationPeer.cs
- TableLayoutRowStyleCollection.cs
- BaseAutoFormat.cs
- SchemaAttDef.cs
- URIFormatException.cs
- TextCompositionManager.cs
- X500Name.cs
- RtfToken.cs
- DBAsyncResult.cs
- GetLastErrorDetailsRequest.cs
- GetMemberBinder.cs
- Int64Animation.cs
- DispatchChannelSink.cs
- Hash.cs
- ReferenceEqualityComparer.cs
- ThrowHelper.cs