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
- DeadLetterQueue.cs
- TraceUtility.cs
- EventLogPermission.cs
- ConfigXmlComment.cs
- DataBindingHandlerAttribute.cs
- SafeFileMappingHandle.cs
- CharacterHit.cs
- CalloutQueueItem.cs
- DecoderBestFitFallback.cs
- OrthographicCamera.cs
- UnsafeNativeMethods.cs
- MergeFailedEvent.cs
- HtmlHead.cs
- Module.cs
- MethodToken.cs
- UrlMapping.cs
- WebContext.cs
- RayHitTestParameters.cs
- AsyncDataRequest.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- XmlRootAttribute.cs
- EntityCommandCompilationException.cs
- EncoderParameters.cs
- FlowDocumentPageViewerAutomationPeer.cs
- AdornedElementPlaceholder.cs
- EnumUnknown.cs
- XmlChildEnumerator.cs
- DefaultTraceListener.cs
- DecoderFallbackWithFailureFlag.cs
- ListenerElementsCollection.cs
- Vector3D.cs
- SystemDiagnosticsSection.cs
- HealthMonitoringSection.cs
- ServiceOperationWrapper.cs
- DataTableCollection.cs
- XmlEnumAttribute.cs
- SwitchElementsCollection.cs
- TiffBitmapEncoder.cs
- ExtendedProtectionPolicy.cs
- PartitionedStreamMerger.cs
- ContentType.cs
- TreeViewAutomationPeer.cs
- ContextProperty.cs
- AttachmentCollection.cs
- Int32EqualityComparer.cs
- WorkflowApplicationAbortedEventArgs.cs
- DiscoveryEndpointElement.cs
- ApplicationServiceHelper.cs
- RecognitionResult.cs
- HttpModule.cs
- DataStreamFromComStream.cs
- GPRECT.cs
- EditorResources.cs
- FileUtil.cs
- FormClosedEvent.cs
- PopOutPanel.cs
- bidPrivateBase.cs
- ListManagerBindingsCollection.cs
- WindowsListViewItem.cs
- SettingsPropertyWrongTypeException.cs
- Internal.cs
- SqlUdtInfo.cs
- ThreadSafeList.cs
- Cursor.cs
- TaskFactory.cs
- NullRuntimeConfig.cs
- CounterSampleCalculator.cs
- CompositeFontParser.cs
- BinaryParser.cs
- OleDbFactory.cs
- CellLabel.cs
- RichTextBoxContextMenu.cs
- RijndaelManaged.cs
- WindowsProgressbar.cs
- Visual.cs
- QueryTask.cs
- EntityTypeEmitter.cs
- ChtmlPhoneCallAdapter.cs
- AccessorTable.cs
- Preprocessor.cs
- SqlParameter.cs
- EventLogPermissionAttribute.cs
- DPAPIProtectedConfigurationProvider.cs
- DataObjectFieldAttribute.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- SettingsProperty.cs
- PopupRootAutomationPeer.cs
- TransactionBridge.cs
- ContextMenuAutomationPeer.cs
- GridViewUpdatedEventArgs.cs
- MsmqIntegrationValidationBehavior.cs
- DoubleIndependentAnimationStorage.cs
- XmlDomTextWriter.cs
- WebContext.cs
- ConfigurationSettings.cs
- DllNotFoundException.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- AuthorizationSection.cs
- IPAddressCollection.cs
- XPathMessageContext.cs