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
- DataGridViewAddColumnDialog.cs
- HtmlButton.cs
- serverconfig.cs
- TextDecoration.cs
- TemplateContainer.cs
- CachingHintValidation.cs
- DataBindingHandlerAttribute.cs
- ContextStaticAttribute.cs
- MetabaseServerConfig.cs
- SharedStatics.cs
- InputProcessorProfilesLoader.cs
- XmlStreamStore.cs
- BooleanToVisibilityConverter.cs
- EditBehavior.cs
- DataGridViewRowsAddedEventArgs.cs
- TypeBrowserDialog.cs
- GPRECT.cs
- CodeTypeMember.cs
- CodeDefaultValueExpression.cs
- GridPatternIdentifiers.cs
- FontConverter.cs
- DataGridViewCellStyle.cs
- DataBoundControl.cs
- InertiaTranslationBehavior.cs
- HttpHandlerActionCollection.cs
- userdatakeys.cs
- ReturnValue.cs
- DoubleStorage.cs
- NonSerializedAttribute.cs
- DataControlReferenceCollection.cs
- Stacktrace.cs
- Mapping.cs
- LogReservationCollection.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- TemplateInstanceAttribute.cs
- Guid.cs
- ValidationUtility.cs
- XamlStackWriter.cs
- Rotation3DAnimationUsingKeyFrames.cs
- Matrix3DStack.cs
- lengthconverter.cs
- CorrelationTokenInvalidatedHandler.cs
- PathSegmentCollection.cs
- DbExpressionVisitor_TResultType.cs
- TableRowGroup.cs
- SequentialUshortCollection.cs
- ClientType.cs
- QuotedPairReader.cs
- IResourceProvider.cs
- ManagedWndProcTracker.cs
- XmlAnyElementAttribute.cs
- XmlEncodedRawTextWriter.cs
- FilterableData.cs
- DataColumnPropertyDescriptor.cs
- ContentDisposition.cs
- HttpCacheParams.cs
- QuaternionAnimation.cs
- HttpConfigurationContext.cs
- LayoutSettings.cs
- GenericPrincipal.cs
- OptimizedTemplateContentHelper.cs
- SlotInfo.cs
- SchemaImporterExtension.cs
- FrameworkTemplate.cs
- RetrieveVirtualItemEventArgs.cs
- XmlSchemaException.cs
- OutputCacheEntry.cs
- MatrixTransform3D.cs
- RegistrationServices.cs
- Gdiplus.cs
- FileSystemWatcher.cs
- GradientStopCollection.cs
- AutomationPeer.cs
- TimeSpanOrInfiniteValidator.cs
- XmlComment.cs
- Vector3DCollection.cs
- SoapAttributeAttribute.cs
- DoubleAnimationClockResource.cs
- UnsafeNativeMethods.cs
- PresentationSource.cs
- Internal.cs
- TrackingMemoryStream.cs
- TableLayoutPanelCellPosition.cs
- handlecollector.cs
- NamespaceEmitter.cs
- TagNameToTypeMapper.cs
- ParseNumbers.cs
- odbcmetadatafactory.cs
- TraceUtility.cs
- KeyToListMap.cs
- CompilationUnit.cs
- TextBlockAutomationPeer.cs
- XmlSchemaElement.cs
- WebPartEditorApplyVerb.cs
- ToolStripStatusLabel.cs
- webeventbuffer.cs
- NonParentingControl.cs
- HtmlLink.cs
- Serializer.cs
- ListViewEditEventArgs.cs