The Labs \ Source Viewer \ SSCLI \ System.Security.Principal \ GenericIdentity

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. //
  16. // GenericIdentity.cs
  17. //
  18. // A generic identity
  19. //
  20. namespace System.Security.Principal
  21. {
  22.     using System.Runtime.Remoting;
  23.     using System;
  24.     using System.Security.Util;
  25.    
  26.     [Serializable()]
  27.     [System.Runtime.InteropServices.ComVisible(true)]
  28.     public class GenericIdentity : IIdentity
  29.     {
  30.         private string m_name;
  31.         private string m_type;
  32.        
  33.         public GenericIdentity(string name)
  34.         {
  35.             if (name == null)
  36.                 throw new ArgumentNullException("name");
  37.            
  38.             m_name = name;
  39.             m_type = "";
  40.         }
  41.        
  42.         public GenericIdentity(string name, string type)
  43.         {
  44.             if (name == null)
  45.                 throw new ArgumentNullException("name");
  46.             if (type == null)
  47.                 throw new ArgumentNullException("type");
  48.            
  49.             m_name = name;
  50.             m_type = type;
  51.         }
  52.        
  53.         public virtual string Name {
  54.             get { return m_name; }
  55.         }
  56.        
  57.         public virtual string AuthenticationType {
  58.             get { return m_type; }
  59.         }
  60.        
  61.         public virtual bool IsAuthenticated {
  62.             get { return !m_name.Equals(""); }
  63.         }
  64.     }
  65. }

Developer Fusion