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
- ActivityCodeGenerator.cs
- ScrollData.cs
- SubMenuStyleCollection.cs
- EdmToObjectNamespaceMap.cs
- DomainConstraint.cs
- MenuEventArgs.cs
- DataErrorValidationRule.cs
- SafeLibraryHandle.cs
- XmlReflectionMember.cs
- AudioBase.cs
- SQLConvert.cs
- IssuedSecurityTokenProvider.cs
- DocumentsTrace.cs
- DbMetaDataColumnNames.cs
- BuildProvider.cs
- OpenFileDialog.cs
- RegexNode.cs
- Comparer.cs
- RSAPKCS1SignatureDeformatter.cs
- GridToolTip.cs
- NativeRecognizer.cs
- DecimalKeyFrameCollection.cs
- TypeUtil.cs
- RowToParametersTransformer.cs
- Convert.cs
- MessageBox.cs
- EventEntry.cs
- DetailsViewDeletedEventArgs.cs
- SetIterators.cs
- CursorInteropHelper.cs
- QilValidationVisitor.cs
- SoapInteropTypes.cs
- AppSettingsExpressionEditor.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- DataListItemEventArgs.cs
- DropDownButton.cs
- MetadataSet.cs
- WindowsGraphicsCacheManager.cs
- CompressionTracing.cs
- HandlerBase.cs
- ResourceDisplayNameAttribute.cs
- XmlObjectSerializerContext.cs
- UnmanagedMemoryStream.cs
- RestHandlerFactory.cs
- PageRequestManager.cs
- Select.cs
- WorkflowItemsPresenter.cs
- TransformerInfoCollection.cs
- DataProtection.cs
- WindowsScroll.cs
- DiscoveryRequestHandler.cs
- ClockController.cs
- ConversionValidationRule.cs
- LayoutExceptionEventArgs.cs
- SharedStatics.cs
- StructuredProperty.cs
- ADConnectionHelper.cs
- SiteMapNodeItem.cs
- ContentElementAutomationPeer.cs
- RunInstallerAttribute.cs
- ProcessDesigner.cs
- EmptyEnumerator.cs
- _NativeSSPI.cs
- TreeNodeBindingDepthConverter.cs
- PeerTransportElement.cs
- RequestCachingSection.cs
- HttpRequest.cs
- ParameterRetriever.cs
- SafeWaitHandle.cs
- SoapSchemaImporter.cs
- ScriptReference.cs
- DateTimePicker.cs
- OperationAbortedException.cs
- InternalRelationshipCollection.cs
- WCFModelStrings.Designer.cs
- _DomainName.cs
- AsnEncodedData.cs
- DataSetMappper.cs
- Bitmap.cs
- InfoCardCryptoHelper.cs
- sitestring.cs
- SoapEnvelopeProcessingElement.cs
- BufferedGraphicsContext.cs
- XomlDesignerLoader.cs
- LocalizationCodeDomSerializer.cs
- TypeUtils.cs
- shaperfactory.cs
- DocumentViewerAutomationPeer.cs
- SizeF.cs
- HtmlGenericControl.cs
- DataGridHyperlinkColumn.cs
- SiteMap.cs
- SafeHandle.cs
- WasAdminWrapper.cs
- ListControl.cs
- NonVisualControlAttribute.cs
- EnumMember.cs
- SemanticResolver.cs
- TableSectionStyle.cs
- PerformanceCounterPermissionAttribute.cs