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
- DocumentOrderQuery.cs
- CodeTypeMember.cs
- TextRangeBase.cs
- IpcClientChannel.cs
- LoginView.cs
- FamilyTypefaceCollection.cs
- AsyncOperationManager.cs
- AncillaryOps.cs
- SessionParameter.cs
- MemberAssignment.cs
- ByteStorage.cs
- Assert.cs
- RolePrincipal.cs
- ActivityStatusChangeEventArgs.cs
- CodeMemberMethod.cs
- ToolStripLocationCancelEventArgs.cs
- WebPartAddingEventArgs.cs
- DynamicDocumentPaginator.cs
- DataFormat.cs
- arc.cs
- AccessViolationException.cs
- FtpCachePolicyElement.cs
- TransformerInfo.cs
- BaseCollection.cs
- ProfileService.cs
- PngBitmapEncoder.cs
- HostExecutionContextManager.cs
- FixedSOMTable.cs
- KnownTypesHelper.cs
- AssertSection.cs
- TrailingSpaceComparer.cs
- XmlRootAttribute.cs
- FrameworkTemplate.cs
- UserControl.cs
- DrawingAttributesDefaultValueFactory.cs
- SecurityElement.cs
- ClientTarget.cs
- XmlTextReaderImpl.cs
- unsafenativemethodstextservices.cs
- MaskPropertyEditor.cs
- BatchParser.cs
- RenderDataDrawingContext.cs
- ToolboxCategoryItems.cs
- MouseWheelEventArgs.cs
- PeerObject.cs
- XmlSignificantWhitespace.cs
- InputLanguageManager.cs
- MetadataLocation.cs
- ObjectToken.cs
- EntityDesignerBuildProvider.cs
- DelayedRegex.cs
- StaticDataManager.cs
- DataGridViewImageColumn.cs
- SelectionRangeConverter.cs
- XmlSchemaExporter.cs
- CollectionChangedEventManager.cs
- Lease.cs
- UnsafeNativeMethods.cs
- TemplateBuilder.cs
- Clipboard.cs
- RequestCacheManager.cs
- HttpMethodConstraint.cs
- SmiGettersStream.cs
- httpserverutility.cs
- SafeProcessHandle.cs
- XmlBinaryReader.cs
- Span.cs
- GeometryCombineModeValidation.cs
- SafeArrayTypeMismatchException.cs
- DelegateTypeInfo.cs
- IisTraceWebEventProvider.cs
- PriorityRange.cs
- NoResizeHandleGlyph.cs
- SystemFonts.cs
- ToolStripActionList.cs
- RefExpr.cs
- NextPreviousPagerField.cs
- RoutedEvent.cs
- MultiView.cs
- arabicshape.cs
- UserMapPath.cs
- TypeInformation.cs
- cookiecontainer.cs
- BreakRecordTable.cs
- WeakReferenceList.cs
- RootNamespaceAttribute.cs
- DiagnosticSection.cs
- AnimatedTypeHelpers.cs
- OletxVolatileEnlistment.cs
- QuotedPrintableStream.cs
- StringAttributeCollection.cs
- SystemIcons.cs
- SecondaryViewProvider.cs
- OdbcHandle.cs
- StaticExtension.cs
- AsyncDataRequest.cs
- NavigationProperty.cs
- ToolStripItemBehavior.cs
- MTConfigUtil.cs
- ListViewDataItem.cs