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
- CodeIdentifiers.cs
- FileDialog.cs
- LocalizedNameDescriptionPair.cs
- DbMetaDataFactory.cs
- Utils.cs
- coordinatorfactory.cs
- ComponentEditorPage.cs
- Point3DCollection.cs
- IncomingWebResponseContext.cs
- FunctionNode.cs
- PageParser.cs
- TextElement.cs
- TextTreeRootNode.cs
- StylusPointDescription.cs
- ResourceBinder.cs
- PageSetupDialog.cs
- ScriptingAuthenticationServiceSection.cs
- InkCanvas.cs
- RectAnimationUsingKeyFrames.cs
- AgileSafeNativeMemoryHandle.cs
- ClientConfigurationSystem.cs
- NativeObjectSecurity.cs
- NaturalLanguageHyphenator.cs
- Brushes.cs
- UnsupportedPolicyOptionsException.cs
- PointLightBase.cs
- EntityDataSourceReferenceGroup.cs
- CorrelationService.cs
- SpeakProgressEventArgs.cs
- LinkDescriptor.cs
- StateChangeEvent.cs
- AddressingVersion.cs
- MarkupCompilePass1.cs
- InvalidEnumArgumentException.cs
- WebService.cs
- DbMetaDataCollectionNames.cs
- RepeaterItem.cs
- InternalDispatchObject.cs
- WebFaultException.cs
- AttachInfo.cs
- StateItem.cs
- HtmlWindowCollection.cs
- ContainerFilterService.cs
- PolyLineSegmentFigureLogic.cs
- DSACryptoServiceProvider.cs
- EventArgs.cs
- TaskFormBase.cs
- OuterGlowBitmapEffect.cs
- RegexReplacement.cs
- Bidi.cs
- ViewBox.cs
- WindowsGrip.cs
- Missing.cs
- XPathParser.cs
- FocusManager.cs
- RuntimeHandles.cs
- WebResponse.cs
- HttpResponseInternalBase.cs
- PropertyInformation.cs
- MessageBox.cs
- IdnMapping.cs
- DynamicMetaObject.cs
- DataSpaceManager.cs
- MimeReflector.cs
- Stack.cs
- NodeFunctions.cs
- HandlerFactoryWrapper.cs
- MetricEntry.cs
- XmlDataDocument.cs
- DesignerCommandAdapter.cs
- DecimalKeyFrameCollection.cs
- OdbcParameter.cs
- CallbackHandler.cs
- CompilerTypeWithParams.cs
- Latin1Encoding.cs
- LogicalExpr.cs
- CssClassPropertyAttribute.cs
- CultureSpecificStringDictionary.cs
- TextBounds.cs
- CodeChecksumPragma.cs
- EndpointIdentity.cs
- XPathEmptyIterator.cs
- WebPartExportVerb.cs
- XmlAttribute.cs
- GridViewPageEventArgs.cs
- TableCell.cs
- CodeNamespaceImportCollection.cs
- ExceptionValidationRule.cs
- RemoteHelper.cs
- BamlMapTable.cs
- GeneralTransform3D.cs
- graph.cs
- XmlSchemaAttribute.cs
- ActivityDesignerLayoutSerializers.cs
- MyContact.cs
- ActiveXSite.cs
- XmlTypeAttribute.cs
- TransformPattern.cs
- SelectionRange.cs
- DataGridViewComboBoxColumnDesigner.cs