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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SystemIcons.cs
- XmlWellformedWriter.cs
- CategoryAttribute.cs
- AuthenticatingEventArgs.cs
- TextElement.cs
- ReadOnlyTernaryTree.cs
- StringHandle.cs
- IntegerFacetDescriptionElement.cs
- KeyFrames.cs
- Instrumentation.cs
- XmlCharType.cs
- XmlAtomicValue.cs
- WinFormsSecurity.cs
- EncoderExceptionFallback.cs
- WaitForChangedResult.cs
- MachineKeySection.cs
- Renderer.cs
- PathNode.cs
- ResourceDefaultValueAttribute.cs
- Msec.cs
- CorrelationManager.cs
- XMLDiffLoader.cs
- ItemCheckEvent.cs
- StrokeCollectionConverter.cs
- ObfuscateAssemblyAttribute.cs
- PowerEase.cs
- Point3DConverter.cs
- FragmentQuery.cs
- EmissiveMaterial.cs
- ApplicationManager.cs
- DesignerProperties.cs
- ObjectReaderCompiler.cs
- BufferModesCollection.cs
- DataGridViewRowStateChangedEventArgs.cs
- CustomAttribute.cs
- DependencyPropertyConverter.cs
- DataContractSerializer.cs
- AudioException.cs
- SafeFileHandle.cs
- GrammarBuilderWildcard.cs
- TargetParameterCountException.cs
- Executor.cs
- ElementAction.cs
- CodeTryCatchFinallyStatement.cs
- GroupBox.cs
- IntegerCollectionEditor.cs
- StaticTextPointer.cs
- SelectionRangeConverter.cs
- EntityClassGenerator.cs
- FamilyTypeface.cs
- Bidi.cs
- ViewCellSlot.cs
- TextRangeEditLists.cs
- WebPartAddingEventArgs.cs
- DataBindingCollection.cs
- CalendarTable.cs
- DataSysAttribute.cs
- HttpModule.cs
- SafeSecurityHelper.cs
- CssClassPropertyAttribute.cs
- UriSection.cs
- MultiByteCodec.cs
- XamlTypeMapper.cs
- CompensableActivity.cs
- SimpleBitVector32.cs
- BookmarkNameHelper.cs
- DataGridViewColumnEventArgs.cs
- DataTable.cs
- KeyConstraint.cs
- PeerNearMe.cs
- CategoryAttribute.cs
- CompilerTypeWithParams.cs
- DomainUpDown.cs
- HttpTransportSecurityElement.cs
- SecurityAccessDeniedException.cs
- SecurityTokenResolver.cs
- SoapInteropTypes.cs
- ProfileInfo.cs
- TransformerInfo.cs
- RawStylusActions.cs
- DataGridViewLinkCell.cs
- TemplateControlParser.cs
- UniqueConstraint.cs
- DiscriminatorMap.cs
- FilteredDataSetHelper.cs
- LoadRetryHandler.cs
- UIElement3D.cs
- RadioButton.cs
- DynamicILGenerator.cs
- CodeTypeMemberCollection.cs
- PrimaryKeyTypeConverter.cs
- SessionStateItemCollection.cs
- path.cs
- BigIntegerStorage.cs
- WebHttpSecurity.cs
- SafeNativeMethodsCLR.cs
- DynamicPropertyHolder.cs
- IntranetCredentialPolicy.cs
- SqlDataSourceView.cs
- ObjectHelper.cs