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
- WebResourceUtil.cs
- ProfileBuildProvider.cs
- PropertyMap.cs
- EventEntry.cs
- SurrogateEncoder.cs
- CqlLexer.cs
- SecurityRuntime.cs
- HtmlFormWrapper.cs
- Parallel.cs
- WebPartConnectionsConfigureVerb.cs
- ListDesigner.cs
- HttpCapabilitiesEvaluator.cs
- DodSequenceMerge.cs
- CodeCompileUnit.cs
- Publisher.cs
- EmptyEnumerable.cs
- ApplicationManager.cs
- WindowPattern.cs
- ButtonBase.cs
- HttpModuleActionCollection.cs
- RegexParser.cs
- SlotInfo.cs
- XmlElementElement.cs
- BeginStoryboard.cs
- TextComposition.cs
- DefaultPrintController.cs
- ColumnHeader.cs
- ListViewTableRow.cs
- AssemblyCache.cs
- InternalUserCancelledException.cs
- TimelineClockCollection.cs
- ScriptingAuthenticationServiceSection.cs
- MeasureItemEvent.cs
- XmlWriterDelegator.cs
- errorpatternmatcher.cs
- DataGridViewBand.cs
- ValueExpressions.cs
- FileLevelControlBuilderAttribute.cs
- OptionUsage.cs
- RegexRunner.cs
- ShapeTypeface.cs
- XmlSchemaImport.cs
- CodeMemberProperty.cs
- NameGenerator.cs
- OdbcConnectionOpen.cs
- ArrangedElement.cs
- DefaultHttpHandler.cs
- SelectionHighlightInfo.cs
- FunctionQuery.cs
- ScrollData.cs
- CompensatableSequenceActivity.cs
- _AcceptOverlappedAsyncResult.cs
- WeakReferenceKey.cs
- WindowsPrincipal.cs
- DynamicHyperLink.cs
- SymbolDocumentGenerator.cs
- DataGridViewRowsAddedEventArgs.cs
- ReaderWriterLock.cs
- WeakEventTable.cs
- BaseDataList.cs
- LineSegment.cs
- ToolBarTray.cs
- AttachedAnnotationChangedEventArgs.cs
- DataMemberAttribute.cs
- DrawingState.cs
- SerialPinChanges.cs
- ItemAutomationPeer.cs
- Visual3D.cs
- InputLangChangeEvent.cs
- EntityContainerAssociationSetEnd.cs
- SelectionChangedEventArgs.cs
- SystemDiagnosticsSection.cs
- SqlProfileProvider.cs
- Parameter.cs
- CapabilitiesUse.cs
- PassportAuthentication.cs
- WindowsFormsHelpers.cs
- QilReference.cs
- InvokeMethodActivityDesigner.cs
- FixedSOMElement.cs
- DataColumnMappingCollection.cs
- CredentialCache.cs
- ResponseStream.cs
- Tool.cs
- DbConnectionPoolIdentity.cs
- DataTable.cs
- Tuple.cs
- MouseOverProperty.cs
- BezierSegment.cs
- ReliableDuplexSessionChannel.cs
- WebPartZoneBase.cs
- Query.cs
- DateTimeStorage.cs
- ForeignKeyConstraint.cs
- ResourceWriter.cs
- FlowDocumentScrollViewer.cs
- EditingCommands.cs
- IndependentAnimationStorage.cs
- DeclarativeCatalogPart.cs
- MimeFormatter.cs