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
- DrawingState.cs
- WindowsScrollBar.cs
- Task.cs
- XmlComment.cs
- BamlRecords.cs
- DataGridViewComboBoxEditingControl.cs
- QueryInterceptorAttribute.cs
- SspiNegotiationTokenProvider.cs
- ProfileSettingsCollection.cs
- WebPartEditorCancelVerb.cs
- CharacterMetrics.cs
- SmiGettersStream.cs
- Function.cs
- ImportContext.cs
- ExpressionConverter.cs
- ChildrenQuery.cs
- RealProxy.cs
- ScriptComponentDescriptor.cs
- PropertyTabAttribute.cs
- TileBrush.cs
- PlainXmlSerializer.cs
- ConsumerConnectionPointCollection.cs
- TaiwanLunisolarCalendar.cs
- XmlSchemaSimpleTypeList.cs
- ProviderIncompatibleException.cs
- SqlInternalConnectionSmi.cs
- PropertyInfoSet.cs
- SafeRightsManagementPubHandle.cs
- LabelEditEvent.cs
- ConfigurationSectionCollection.cs
- _NegoStream.cs
- WebPartConnectVerb.cs
- TableCellCollection.cs
- HandlerWithFactory.cs
- Utils.cs
- SharedPersonalizationStateInfo.cs
- ByteConverter.cs
- WorkflowApplicationCompletedException.cs
- METAHEADER.cs
- GeometryGroup.cs
- PageBorderless.cs
- DataControlCommands.cs
- TemplatedWizardStep.cs
- FileDialog.cs
- CustomTypeDescriptor.cs
- EventRoute.cs
- DummyDataSource.cs
- InvalidOperationException.cs
- TemplateControl.cs
- CellLabel.cs
- MemoryMappedFileSecurity.cs
- CodeTypeDeclaration.cs
- RenderOptions.cs
- KoreanLunisolarCalendar.cs
- SqlHelper.cs
- FlowDocumentPage.cs
- TemplateBindingExtensionConverter.cs
- XmlSchemaAnnotated.cs
- CompositeKey.cs
- assemblycache.cs
- RuleProcessor.cs
- PageCache.cs
- ComboBoxRenderer.cs
- State.cs
- WpfXamlMember.cs
- DataGridViewColumnEventArgs.cs
- SmtpReplyReaderFactory.cs
- DataRecordInfo.cs
- DetailsViewRowCollection.cs
- XmlNodeChangedEventManager.cs
- TraceListeners.cs
- MaterializeFromAtom.cs
- ValidationHelper.cs
- _SpnDictionary.cs
- XamlParser.cs
- SynchronizationFilter.cs
- VirtualPath.cs
- SHA384.cs
- ChtmlImageAdapter.cs
- Parameter.cs
- LicFileLicenseProvider.cs
- WS2007HttpBinding.cs
- InputManager.cs
- CaretElement.cs
- QilSortKey.cs
- SqlBulkCopy.cs
- ResolveMatches11.cs
- LazyTextWriterCreator.cs
- BindingsCollection.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- HostDesigntimeLicenseContext.cs
- SystemIPGlobalStatistics.cs
- TraceSwitch.cs
- WMIInterop.cs
- PersonalizationProviderHelper.cs
- SchemaEntity.cs
- RegexCompilationInfo.cs
- ImageMap.cs
- CapabilitiesAssignment.cs
- XmlAttributes.cs