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
- VirtualizingPanel.cs
- CodeEntryPointMethod.cs
- CollectionsUtil.cs
- DiffuseMaterial.cs
- ConfigurationPropertyCollection.cs
- DelegatingConfigHost.cs
- DatagramAdapter.cs
- DataSourceSelectArguments.cs
- Selection.cs
- TextTreeDeleteContentUndoUnit.cs
- SafeMILHandleMemoryPressure.cs
- Viewport3DAutomationPeer.cs
- FormDesigner.cs
- AttachedPropertyInfo.cs
- WmlValidationSummaryAdapter.cs
- Substitution.cs
- DelegateBodyWriter.cs
- CustomErrorCollection.cs
- BaseCollection.cs
- SqlCaseSimplifier.cs
- DataGridViewCellStateChangedEventArgs.cs
- EntityContainerRelationshipSetEnd.cs
- CheckBoxBaseAdapter.cs
- EventPrivateKey.cs
- CapabilitiesState.cs
- ErrorRuntimeConfig.cs
- NullableDecimalSumAggregationOperator.cs
- Mouse.cs
- IDictionary.cs
- FormViewModeEventArgs.cs
- AutomationPatternInfo.cs
- InvalidFilterCriteriaException.cs
- DataListItemEventArgs.cs
- EntitySqlQueryCacheKey.cs
- MailAddressCollection.cs
- HandleCollector.cs
- RadioButtonBaseAdapter.cs
- DataGridState.cs
- MissingMethodException.cs
- ThreadStartException.cs
- SortFieldComparer.cs
- LoginCancelEventArgs.cs
- SmtpReplyReaderFactory.cs
- sqlmetadatafactory.cs
- Hashtable.cs
- X500Name.cs
- DataPagerFieldItem.cs
- MediaTimeline.cs
- RecognizerStateChangedEventArgs.cs
- SystemDropShadowChrome.cs
- TypeSystem.cs
- XpsDocument.cs
- ScriptReferenceBase.cs
- UnsafeCollabNativeMethods.cs
- TypeDescriptor.cs
- DataServiceExpressionVisitor.cs
- FileUpload.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- DbConnectionPoolGroup.cs
- EventLogPermission.cs
- BitmapVisualManager.cs
- Collection.cs
- ResXBuildProvider.cs
- UITypeEditor.cs
- SqlDataSourceCache.cs
- SerialStream.cs
- ServiceDescription.cs
- BezierSegment.cs
- FileIOPermission.cs
- ServerIdentity.cs
- _DisconnectOverlappedAsyncResult.cs
- XmlSchemaSubstitutionGroup.cs
- PerformanceCountersElement.cs
- SecurityCriticalDataForSet.cs
- ToolStripDropDown.cs
- TableLayoutColumnStyleCollection.cs
- XmlArrayItemAttribute.cs
- CurrentChangedEventManager.cs
- TailCallAnalyzer.cs
- Completion.cs
- Timer.cs
- LocatorPart.cs
- CreateUserWizardDesigner.cs
- ReachDocumentPageSerializer.cs
- PenLineCapValidation.cs
- ServerIdentity.cs
- BindingMAnagerBase.cs
- ImportContext.cs
- XmlDictionaryReaderQuotas.cs
- BinaryUtilClasses.cs
- Pipe.cs
- RequestValidator.cs
- FastEncoder.cs
- BindingNavigator.cs
- HttpWebRequest.cs
- CodeDOMProvider.cs
- IndexingContentUnit.cs
- ProtocolsConfiguration.cs
- SQLUtility.cs
- XmlReflectionImporter.cs