Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------ // 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
- RoutedEventArgs.cs
- Stack.cs
- SelectionRange.cs
- HtmlInputControl.cs
- AbandonedMutexException.cs
- FileAuthorizationModule.cs
- ContainerControl.cs
- SspiNegotiationTokenAuthenticator.cs
- XmlCDATASection.cs
- QilChoice.cs
- FixedMaxHeap.cs
- FormsIdentity.cs
- UpWmlMobileTextWriter.cs
- VariantWrapper.cs
- HitTestDrawingContextWalker.cs
- CTreeGenerator.cs
- AttributeAction.cs
- BinaryParser.cs
- ControlCollection.cs
- NavigationService.cs
- HealthMonitoringSectionHelper.cs
- XmlSchemaAttributeGroup.cs
- WorkflowRequestContext.cs
- BoundField.cs
- ContainerControl.cs
- DocumentAutomationPeer.cs
- TextSelectionProcessor.cs
- ThrowHelper.cs
- RightsManagementEncryptionTransform.cs
- WindowsSpinner.cs
- State.cs
- Stacktrace.cs
- JulianCalendar.cs
- ToolStripDropDown.cs
- LineServices.cs
- CodeGenerator.cs
- RequestQueue.cs
- AttributeProviderAttribute.cs
- ReflectionPermission.cs
- ToolStripTemplateNode.cs
- RSACryptoServiceProvider.cs
- Restrictions.cs
- SqlDataSourceFilteringEventArgs.cs
- SelectionItemPattern.cs
- IncomingWebResponseContext.cs
- TextServicesProperty.cs
- CommandEventArgs.cs
- StylusPointProperty.cs
- AudienceUriMode.cs
- LocationReference.cs
- Operators.cs
- PropertyCollection.cs
- DispatcherTimer.cs
- GridViewRowPresenter.cs
- FieldDescriptor.cs
- ExpressionNode.cs
- Utils.cs
- TabControlEvent.cs
- XmlDataImplementation.cs
- WebHttpBindingCollectionElement.cs
- Perspective.cs
- AnimationTimeline.cs
- StringPropertyBuilder.cs
- FixedSOMFixedBlock.cs
- ControlsConfig.cs
- safex509handles.cs
- SuppressMergeCheckAttribute.cs
- SerialStream.cs
- ThicknessConverter.cs
- CorrelationResolver.cs
- CodeConstructor.cs
- CollectionViewGroupInternal.cs
- SettingsContext.cs
- ContainerActivationHelper.cs
- PropertyTabChangedEvent.cs
- DataBoundControlAdapter.cs
- ToolStripItemTextRenderEventArgs.cs
- ZipIOModeEnforcingStream.cs
- XmlLinkedNode.cs
- GetPageCompletedEventArgs.cs
- ObjectDataSourceMethodEventArgs.cs
- GlyphInfoList.cs
- PeerDefaultCustomResolverClient.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ProfileParameter.cs
- AnnotationHighlightLayer.cs
- DataContractSerializerSection.cs
- SocketAddress.cs
- FastEncoderWindow.cs
- DecimalConstantAttribute.cs
- StringSorter.cs
- ToolboxBitmapAttribute.cs
- CompiledAction.cs
- GacUtil.cs
- FormViewInsertEventArgs.cs
- XhtmlBasicPageAdapter.cs
- dataprotectionpermissionattribute.cs
- StrokeCollection.cs
- SimpleWebHandlerParser.cs
- ExpressionConverter.cs