2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
[mono.git] / mcs / class / System.Web / System.Web.Security / FormsAuthentication.cs
1 /**\r
2  * Namespace: System.Web.Security\r
3  * Class:     FormsAuthentication\r
4  * \r
5  * Author:  Gaurav Vaish\r
6  * Maintainer: gvaish@iitk.ac.in\r
7  * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
8  * Implementation: yes\r
9  * Status:  ??%\r
10  * \r
11  * (C) Gaurav Vaish (2002)\r
12  */\r
13 \r
14 using System;\r
15 using System.Web;\r
16 \r
17 namespace System.Web.Security\r
18 {\r
19         public sealed class FormsAuthentication\r
20         {\r
21                 private static formsCookieName;\r
22                 private static formsCookiePath;\r
23                 \r
24                 private static bool isIntialized = false;\r
25 \r
26                 public FormsAuthentication()\r
27                 {\r
28                 }\r
29                 \r
30                 public static string FormsCookieName\r
31                 {\r
32                         get\r
33                         {\r
34                                 Initialize();\r
35                                 return formsCookieName;\r
36                         }\r
37                 }\r
38                 \r
39                 public static string FormsCookiePath\r
40                 {\r
41                         get\r
42                         {\r
43                                 Initialize();\r
44                                 return formsCookiePath;\r
45                         }\r
46                 }\r
47                 \r
48                 public static bool Authenticate(string name, string password)\r
49                 {\r
50                         if(name != null && password != null)\r
51                         {\r
52                                 Initialize();\r
53                                 AuthenticationConfig cfg = (AuthenticatonConfig)HttpContext.Current.GetConfig("system.web/authentication");\r
54                                 Hashtable db = cfg.Credentials;\r
55                                 if(db == null)\r
56                                 {\r
57                                         //TraceBack("No_user_database");\r
58                                         return false;\r
59                                 }\r
60                                 string passwd = (String)(db[name.ToLower()]);\r
61                                 if(passwd == null)\r
62                                 {\r
63                                         //Traceback("No_user_in_databse")\r
64                                         return false;\r
65                                 }\r
66                                 switch(cfg.PasswordFormat)\r
67                                 {\r
68                                         \r
69                                 }\r
70                         }\r
71                         return false;\r
72                 }\r
73         }\r
74 }\r