2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System.Web / System.Web.Security / FormsAuthentication.cs
index 66e0320e227e6d34bb46d8bac9e339183e2fe58b..451cb0dc260ab231a062eb49ac510197072a851f 100644 (file)
@@ -7,6 +7,27 @@
 // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
 //
 
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
 using System;
 using System.Collections;
 using System.IO;
@@ -26,6 +47,10 @@ namespace System.Web.Security
                static string cookiePath;
                static int timeout;
                static FormsProtectionEnum protection;
+#if NET_1_1
+               static bool requireSSL;
+               static bool slidingExpiration;
+#endif
 
                // same names and order used in xsp
                static string [] indexFiles = { "index.aspx",
@@ -87,7 +112,7 @@ namespace System.Web.Security
                                                                        (values [4] == "1"),
                                                                        values [5],
                                                                        values [6]);
-                       } catch (Exception e) {
+                       } catch (Exception) {
                                ticket = null;
                        }
 
@@ -240,11 +265,18 @@ namespace System.Web.Security
                                        timeout = authConfig.Timeout;
                                        cookiePath = authConfig.CookiePath;
                                        protection = authConfig.Protection;
+#if NET_1_1
+                                       requireSSL = authConfig.RequireSSL;
+                                       slidingExpiration = authConfig.SlidingExpiration;
+#endif
                                } else {
                                        cookieName = ".MONOAUTH";
                                        timeout = 30;
                                        cookiePath = "/";
                                        protection = FormsProtectionEnum.All;
+#if NET_1_1
+                                       slidingExpiration = true;
+#endif
                                }
 
                                initialized = true;
@@ -279,7 +311,7 @@ namespace System.Web.Security
                                return tOld;
 
                        FormsAuthenticationTicket tNew = tOld.Clone ();
-                       tNew.SetDates (now, now - toExpiration + toIssue);
+                       tNew.SetDates (now, now + (tOld.Expiration - tOld.IssueDate));
                        return tNew;
                }
 
@@ -332,6 +364,21 @@ namespace System.Web.Security
                                return cookiePath;
                        }
                }
+#if NET_1_1
+               public static bool RequireSSL {
+                       get {
+                               Initialize ();
+                               return requireSSL;
+                       }
+               }
+
+               public static bool SlidingExpiration {
+                       get {
+                               Initialize ();
+                               return slidingExpiration;
+                       }
+               }
+#endif
        }
 }