Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Selectors / CustomUserNameSecurityTokenAuthenticator.cs / 1 / CustomUserNameSecurityTokenAuthenticator.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Selectors { using System.Collections.Generic; using System.Collections.ObjectModel; using System.IdentityModel.Claims; using System.IdentityModel.Policy; using System.IdentityModel.Tokens; using System.Security.Principal; public class CustomUserNameSecurityTokenAuthenticator : UserNameSecurityTokenAuthenticator { UserNamePasswordValidator validator; public CustomUserNameSecurityTokenAuthenticator(UserNamePasswordValidator validator) { if (validator == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("validator"); this.validator = validator; } protected override ReadOnlyCollectionValidateUserNamePasswordCore(string userName, string password) { this.validator.Validate(userName, password); return SecurityUtils.CreateAuthorizationPolicies(new UserNameClaimSet(userName, validator.GetType().Name)); } class UserNameClaimSet : DefaultClaimSet, IIdentityInfo { IIdentity identity; public UserNameClaimSet(string userName, string authType) { if (userName == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("userName"); this.identity = SecurityUtils.CreateIdentity(userName, authType); List claims = new List (2); claims.Add(new Claim(ClaimTypes.Name, userName, Rights.Identity)); claims.Add(Claim.CreateNameClaim(userName)); Initialize(ClaimSet.System, claims); } public IIdentity Identity { get { return this.identity; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FixedDSBuilder.cs
- ToolStripCodeDomSerializer.cs
- SqlCacheDependencyDatabaseCollection.cs
- PersistenceProviderBehavior.cs
- CompositeFontParser.cs
- COMException.cs
- CookieParameter.cs
- Attribute.cs
- sqlinternaltransaction.cs
- SerializationException.cs
- WebPartHelpVerb.cs
- FieldToken.cs
- SmtpNtlmAuthenticationModule.cs
- SingleResultAttribute.cs
- XmlProcessingInstruction.cs
- Html32TextWriter.cs
- WebControlAdapter.cs
- HtmlDocument.cs
- GenericRootAutomationPeer.cs
- RowVisual.cs
- ZipIOModeEnforcingStream.cs
- ToolStripDropDownItem.cs
- OnOperation.cs
- CodeCatchClause.cs
- SendOperation.cs
- Int32CollectionConverter.cs
- ClockController.cs
- TransformerConfigurationWizardBase.cs
- ColorDialog.cs
- XmlSchemaComplexContentExtension.cs
- GenericEnumerator.cs
- EntityDataSourceChangingEventArgs.cs
- DoubleLinkListEnumerator.cs
- ControlAdapter.cs
- HttpContextServiceHost.cs
- TextProperties.cs
- MultipartIdentifier.cs
- TransformProviderWrapper.cs
- PersianCalendar.cs
- MailWebEventProvider.cs
- InternalConfigRoot.cs
- HitTestDrawingContextWalker.cs
- UnSafeCharBuffer.cs
- AsyncOperationManager.cs
- AmbientValueAttribute.cs
- UIElementParagraph.cs
- SHA1CryptoServiceProvider.cs
- GetKeyedHashRequest.cs
- WebServiceMethodData.cs
- ProfileSettingsCollection.cs
- TextSpan.cs
- PackageRelationshipCollection.cs
- LockCookie.cs
- DynamicPropertyHolder.cs
- TextParaClient.cs
- UInt64Converter.cs
- DynamicPropertyReader.cs
- RequestQueue.cs
- IdleTimeoutMonitor.cs
- XmlUtf8RawTextWriter.cs
- TreeViewItem.cs
- WindowsBrush.cs
- SqlProvider.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- EventMap.cs
- MediaTimeline.cs
- StrokeNodeData.cs
- OSFeature.cs
- DateTimeValueSerializer.cs
- XsdDuration.cs
- AutoGeneratedFieldProperties.cs
- DataGridViewCell.cs
- DocumentGridContextMenu.cs
- SingleStorage.cs
- BitmapEffectvisualstate.cs
- ToolTip.cs
- Label.cs
- ShaderRenderModeValidation.cs
- SafeHandles.cs
- AstTree.cs
- Root.cs
- ElementFactory.cs
- UIHelper.cs
- UnmanagedMarshal.cs
- ApplicationFileCodeDomTreeGenerator.cs
- MessageAction.cs
- TableCell.cs
- QueryComponents.cs
- UpdateTranslator.cs
- ScopelessEnumAttribute.cs
- SqlDataSourceSelectingEventArgs.cs
- SqlDataReader.cs
- ImageSource.cs
- SystemColorTracker.cs
- PublishLicense.cs
- SponsorHelper.cs
- MouseGestureConverter.cs
- MissingSatelliteAssemblyException.cs
- SoapExtensionImporter.cs
- Localizer.cs