Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / ClientServices / ClientFormsIdentity.cs / 1 / ClientFormsIdentity.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.ClientServices { using System; using System.Net; using System.Security.Principal; using System.Runtime.InteropServices; using System.Security; using System.Web.Security; using System.Diagnostics.CodeAnalysis; public class ClientFormsIdentity : IIdentity, IDisposable { public string Name { get { return _Name; }} public bool IsAuthenticated { get { return _IsAuthenticated; }} public string AuthenticationType { get { return _AuthenticationType; } } public CookieContainer AuthenticationCookies { get { return _AuthenticationCookies; } } public MembershipProvider Provider { get { return _Provider; } } public ClientFormsIdentity(string name, string password, MembershipProvider provider, string authenticationType, bool isAuthenticated, CookieContainer authenticationCookies) { _Name = name; _AuthenticationType = authenticationType; _IsAuthenticated = isAuthenticated; _AuthenticationCookies = authenticationCookies; _Password = GetSecureStringFromString(password); _Provider = provider; } public void RevalidateUser() { _Provider.ValidateUser(_Name, GetStringFromSecureString(_Password)); } public void Dispose() { _Password.Dispose(); } private string _Name; private bool _IsAuthenticated; private string _AuthenticationType; private CookieContainer _AuthenticationCookies; private SecureString _Password; private MembershipProvider _Provider; private static SecureString GetSecureStringFromString(string password) { char[] passwordChars = password.ToCharArray(); SecureString ss = new SecureString(); for (int iter = 0; iter < passwordChars.Length; iter++) ss.AppendChar(passwordChars[iter]); ss.MakeReadOnly(); return ss; } [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification="Reviewed and approved by feature crew")] private static string GetStringFromSecureString(SecureString securePass) { IntPtr bstr = IntPtr.Zero; try { bstr = Marshal.SecureStringToBSTR(securePass); return Marshal.PtrToStringBSTR(bstr); } finally { if (bstr != IntPtr.Zero) Marshal.FreeBSTR(bstr); } } } } // 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
- CLSCompliantAttribute.cs
- _SslState.cs
- SafeEventLogWriteHandle.cs
- KoreanLunisolarCalendar.cs
- updateconfighost.cs
- ChildChangedEventArgs.cs
- RedistVersionInfo.cs
- DataError.cs
- HuffModule.cs
- MetadataArtifactLoaderComposite.cs
- ProfileParameter.cs
- ConfigurationLocation.cs
- SystemNetHelpers.cs
- Page.cs
- EasingKeyFrames.cs
- SelectiveScrollingGrid.cs
- CommentAction.cs
- TypeDelegator.cs
- ConfigXmlElement.cs
- HttpRequestTraceRecord.cs
- ServicePointManager.cs
- ResizeGrip.cs
- EasingQuaternionKeyFrame.cs
- XmlExtensionFunction.cs
- TabletDevice.cs
- XmlStreamStore.cs
- ByteAnimationBase.cs
- CustomAttributeBuilder.cs
- PropertyGridCommands.cs
- UnionCodeGroup.cs
- SoapInteropTypes.cs
- SmtpNetworkElement.cs
- SiteMapNodeCollection.cs
- GridViewSelectEventArgs.cs
- AppDomainFactory.cs
- _ShellExpression.cs
- BooleanStorage.cs
- BulletedListEventArgs.cs
- AsymmetricCryptoHandle.cs
- oledbmetadatacollectionnames.cs
- ResponseStream.cs
- CrossContextChannel.cs
- ClientSideProviderDescription.cs
- MexHttpsBindingCollectionElement.cs
- ModulesEntry.cs
- ParseHttpDate.cs
- ResourceAssociationSet.cs
- ReadOnlyHierarchicalDataSourceView.cs
- IODescriptionAttribute.cs
- SqlClientWrapperSmiStreamChars.cs
- ProfileInfo.cs
- StrokeNode.cs
- VisualTreeHelper.cs
- ColorKeyFrameCollection.cs
- Misc.cs
- CapiHashAlgorithm.cs
- ResourceProviderFactory.cs
- SmtpSection.cs
- DataTableMapping.cs
- BreadCrumbTextConverter.cs
- Pair.cs
- ChainedAsyncResult.cs
- GlyphElement.cs
- DisplayNameAttribute.cs
- TextEffect.cs
- ProjectionPathBuilder.cs
- QuotedPrintableStream.cs
- InputLanguageCollection.cs
- WasEndpointConfigContainer.cs
- OleDbFactory.cs
- Queue.cs
- DbFunctionCommandTree.cs
- XmlTextEncoder.cs
- versioninfo.cs
- CodeTypeMember.cs
- BlurBitmapEffect.cs
- ComplexPropertyEntry.cs
- SimplePropertyEntry.cs
- Range.cs
- SafeNativeMethodsMilCoreApi.cs
- HttpPostedFile.cs
- GradientStop.cs
- CodeDirectionExpression.cs
- CompositeFontParser.cs
- Validator.cs
- ItemContainerPattern.cs
- CorrelationTokenInvalidatedHandler.cs
- ResourceExpressionBuilder.cs
- XmlUnspecifiedAttribute.cs
- CollectionViewProxy.cs
- ViewManager.cs
- VectorAnimation.cs
- ReadOnlyDictionary.cs
- TransformCryptoHandle.cs
- SoapFault.cs
- AtomServiceDocumentSerializer.cs
- PerformanceCountersElement.cs
- WebPartConnectionsCancelVerb.cs
- ColorConvertedBitmap.cs
- EditingCommands.cs