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
- ComplexTypeEmitter.cs
- Schedule.cs
- BypassElementCollection.cs
- Char.cs
- Utility.cs
- MultiPropertyDescriptorGridEntry.cs
- FormatSettings.cs
- DataGridRow.cs
- OptimalBreakSession.cs
- NetworkAddressChange.cs
- CachedTypeface.cs
- LinqTreeNodeEvaluator.cs
- MergeFilterQuery.cs
- XmlAnyAttributeAttribute.cs
- TextEditorTables.cs
- URLIdentityPermission.cs
- ActivityDesignerLayoutSerializers.cs
- ConsoleEntryPoint.cs
- Comparer.cs
- UpDownBase.cs
- IBuiltInEvidence.cs
- WindowsFormsEditorServiceHelper.cs
- ButtonStandardAdapter.cs
- MenuAdapter.cs
- SolidColorBrush.cs
- Route.cs
- wgx_sdk_version.cs
- MethodAccessException.cs
- DataControlImageButton.cs
- CodeCommentStatementCollection.cs
- StaticFileHandler.cs
- ColumnMapProcessor.cs
- InstanceStoreQueryResult.cs
- TemplatePropertyEntry.cs
- NonVisualControlAttribute.cs
- StaticExtensionConverter.cs
- TableProvider.cs
- XmlSchemaChoice.cs
- UnauthorizedWebPart.cs
- DropDownList.cs
- ProtocolReflector.cs
- UTF8Encoding.cs
- ClientCredentialsSecurityTokenManager.cs
- OdbcHandle.cs
- InvokeHandlers.cs
- FixedPosition.cs
- TextEditorThreadLocalStore.cs
- ApplicationId.cs
- RenderDataDrawingContext.cs
- CompositeCollectionView.cs
- ThicknessAnimation.cs
- ComponentGlyph.cs
- QilScopedVisitor.cs
- SystemIPInterfaceStatistics.cs
- SafeThemeHandle.cs
- UnauthorizedAccessException.cs
- Menu.cs
- TextContainerHelper.cs
- shaper.cs
- CustomCategoryAttribute.cs
- DataException.cs
- IPPacketInformation.cs
- EntityTypeBase.cs
- DataSourceDesigner.cs
- TypeRefElement.cs
- UnsafeMethods.cs
- ImageCreator.cs
- WindowsListViewGroupHelper.cs
- CheckPair.cs
- SecurityContext.cs
- HttpSocketManager.cs
- propertytag.cs
- diagnosticsswitches.cs
- Mapping.cs
- XPathAxisIterator.cs
- CdpEqualityComparer.cs
- MdImport.cs
- SchemaTypeEmitter.cs
- HtmlControlAdapter.cs
- BidOverLoads.cs
- InputEventArgs.cs
- DataServiceRequestOfT.cs
- StorageEntitySetMapping.cs
- TreeViewDesigner.cs
- CommonObjectSecurity.cs
- InkCanvasSelectionAdorner.cs
- ContentPlaceHolder.cs
- ProcessStartInfo.cs
- FontCollection.cs
- ResetableIterator.cs
- XmlBaseWriter.cs
- ExpressionNode.cs
- dtdvalidator.cs
- TablePattern.cs
- ItemCheckEvent.cs
- CodeNamespaceImport.cs
- DataGridViewLinkCell.cs
- HttpCapabilitiesBase.cs
- HtmlInputText.cs
- ADMembershipUser.cs