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
- ErrorTableItemStyle.cs
- StateItem.cs
- BindingSourceDesigner.cs
- KeyConverter.cs
- ImportContext.cs
- SystemResourceKey.cs
- LinqDataSourceInsertEventArgs.cs
- ZoneMembershipCondition.cs
- Relationship.cs
- ErrorStyle.cs
- SecureEnvironment.cs
- RegistryConfigurationProvider.cs
- FontWeights.cs
- _SslState.cs
- ProgressBar.cs
- FixedLineResult.cs
- FontClient.cs
- LinqDataSourceUpdateEventArgs.cs
- ProxyGenerator.cs
- SelectionProviderWrapper.cs
- SynchronousChannelMergeEnumerator.cs
- ResetableIterator.cs
- RenderData.cs
- SecurityProtocolFactory.cs
- MethodCallConverter.cs
- XmlAttributeOverrides.cs
- GeneralTransformGroup.cs
- FontWeights.cs
- OwnerDrawPropertyBag.cs
- StreamGeometry.cs
- DelayedRegex.cs
- TextRunProperties.cs
- FragmentQueryKB.cs
- SqlNamer.cs
- Compilation.cs
- ExtendedProtectionPolicyTypeConverter.cs
- SocketStream.cs
- PackWebRequestFactory.cs
- UrlAuthorizationModule.cs
- GroupBoxRenderer.cs
- SmtpReplyReaderFactory.cs
- MsmqAppDomainProtocolHandler.cs
- WebPartEventArgs.cs
- DateTime.cs
- UniqueSet.cs
- RadioButtonFlatAdapter.cs
- SQLBinaryStorage.cs
- ServiceNameElement.cs
- DesignerSerializationManager.cs
- OutOfMemoryException.cs
- OleDbMetaDataFactory.cs
- __Filters.cs
- Attributes.cs
- TraceHandler.cs
- DropSource.cs
- RowToFieldTransformer.cs
- XmlLinkedNode.cs
- ReflectionTypeLoadException.cs
- DesignerSerializationOptionsAttribute.cs
- OdbcDataReader.cs
- SimpleModelProvider.cs
- CollectionViewGroup.cs
- SqlStream.cs
- DataGridViewRowPrePaintEventArgs.cs
- RequestCacheManager.cs
- HtmlSelect.cs
- CompilerGlobalScopeAttribute.cs
- QilGeneratorEnv.cs
- CommandEventArgs.cs
- TextRangeEditTables.cs
- Bold.cs
- WebResourceAttribute.cs
- CodeTypeDelegate.cs
- TransportOutputChannel.cs
- GeometryModel3D.cs
- categoryentry.cs
- MenuItemStyleCollection.cs
- SettingsPropertyValue.cs
- ListBoxItemWrapperAutomationPeer.cs
- CommonObjectSecurity.cs
- securitycriticaldataClass.cs
- IdentityHolder.cs
- WebPartDescriptionCollection.cs
- ModuleBuilderData.cs
- SortExpressionBuilder.cs
- StrokeSerializer.cs
- TreeNodeBindingDepthConverter.cs
- WindowsFormsHelpers.cs
- SQLBinaryStorage.cs
- EncoderNLS.cs
- ActionFrame.cs
- DragCompletedEventArgs.cs
- SafeTokenHandle.cs
- GacUtil.cs
- FullTextState.cs
- TableRowCollection.cs
- Selection.cs
- FlowDocumentScrollViewer.cs
- DecimalConstantAttribute.cs
- SignatureDescription.cs