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
- MemberRelationshipService.cs
- HitTestWithGeometryDrawingContextWalker.cs
- WebServiceClientProxyGenerator.cs
- ClientFormsAuthenticationCredentials.cs
- PriorityBindingExpression.cs
- HttpHandlerAction.cs
- Enum.cs
- WebPartMinimizeVerb.cs
- COAUTHINFO.cs
- PasswordPropertyTextAttribute.cs
- XmlSchemaSimpleType.cs
- Int32Converter.cs
- ProcessInfo.cs
- PropertyIDSet.cs
- SafeNativeMethodsCLR.cs
- EpmSourceTree.cs
- EdmEntityTypeAttribute.cs
- WorkflowDesignerColors.cs
- VisemeEventArgs.cs
- DisableDpiAwarenessAttribute.cs
- ColorKeyFrameCollection.cs
- ImageCodecInfoPrivate.cs
- DataPagerFieldCommandEventArgs.cs
- XmlSchemaAppInfo.cs
- SafeMemoryMappedFileHandle.cs
- DocumentAutomationPeer.cs
- DrawingContextFlattener.cs
- SerializableAttribute.cs
- connectionpool.cs
- DesignerActionGlyph.cs
- DataFormats.cs
- FixedMaxHeap.cs
- EntityDataSourceStatementEditorForm.cs
- RuleInfoComparer.cs
- Int32Converter.cs
- PackageStore.cs
- TextLine.cs
- OdbcCommandBuilder.cs
- ProxyWebPart.cs
- WorkflowMarkupSerializerMapping.cs
- PerfCounters.cs
- CFStream.cs
- UdpUtility.cs
- TextDecorations.cs
- XmlILIndex.cs
- SQLConvert.cs
- FixedHyperLink.cs
- EntityDataSourceDataSelection.cs
- QueryUtil.cs
- Vector3DCollectionConverter.cs
- RequestCachingSection.cs
- CompiledRegexRunnerFactory.cs
- ValidationPropertyAttribute.cs
- SettingsAttributeDictionary.cs
- TemplateBindingExpressionConverter.cs
- AutomationAttributeInfo.cs
- JulianCalendar.cs
- SupportsEventValidationAttribute.cs
- Variable.cs
- DocumentPageViewAutomationPeer.cs
- XmlSchemas.cs
- PersistNameAttribute.cs
- DescendentsWalker.cs
- SizeAnimationBase.cs
- DrawingGroup.cs
- Vector.cs
- SoapDocumentServiceAttribute.cs
- Duration.cs
- SelfIssuedAuthAsymmetricKey.cs
- ConcurrentBag.cs
- SpellerError.cs
- GACIdentityPermission.cs
- KeyConstraint.cs
- PropertyDescriptorCollection.cs
- DoubleCollectionConverter.cs
- SourceElementsCollection.cs
- CharacterString.cs
- SchemaImporter.cs
- WebPartDisplayMode.cs
- ColorTypeConverter.cs
- MachineKeySection.cs
- PrivilegeNotHeldException.cs
- ObjectDataProvider.cs
- SeekableReadStream.cs
- WebPartTransformer.cs
- SafeLibraryHandle.cs
- HierarchicalDataBoundControl.cs
- TextBlock.cs
- MemoryPressure.cs
- Exceptions.cs
- CommandPlan.cs
- ThaiBuddhistCalendar.cs
- TextShapeableCharacters.cs
- HierarchicalDataBoundControlAdapter.cs
- CommentAction.cs
- TriState.cs
- HelpProvider.cs
- CachingHintValidation.cs
- DefaultAssemblyResolver.cs
- WindowsComboBox.cs