summaryrefslogtreecommitdiff
path: root/framework/Web/Security/TFormsAuthenticationModule.php
blob: df0d5300aaa09b88daedcbd4cf1488cc9e6692d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/**
 * TFormsAuthenticationModule class.
 * Sets the identity of the user for an PRADO application when forms authentication is enabled. 
 * This class cannot be inherited.
 *
 * @author Jason Ragsdale <jrags@jasrags.net>
 * @version $Id: TFormsAuthenticationModule.php 1398 2006-09-08 19:31:03Z xue $
 * @package System.Web.Security
 * @since 3.1
 */
final class TFormsAuthenticationModule extends TModule
{
	/**
	 * @var boolean if the module has been initialized
	 */
	private $_initialized=false;
	
	private static $_fAuthChecked=false;
	private static $_fAuthRequired=false;
	private $_fFormsInit;
	private $_formsName;
	private $_loginUrl;
	const CONFIG_DEFAULT_COOKIE = ".ASPXAUTH";
	const CONFIG_DEFAULT_LOGINURL = "login.aspx";

	//Is this the best way to do it?? i dont see how the forms module knows about the provider
	private $_defaultProvider;
	
	public function getDefaultProvider()
	{
		return $this->_defaultProvider;
	}
	public function setDefaultProvider($value)
	{
		$this->_defaultProvider = TPropertyValue::ensureString($value);
	}
	
	public function __construct()
	{

	}
	/**
	 * Initializes this module.
	 * This method is required by the IModule interface.
	 * @param TXmlElement configuration for this module, can be null
	 * @throws TConfigurationException if user manager does not exist or is not IUserManager
	 */
	public function init($config)
	{
		$this->getApplication()->attachEventHandler('OnAuthentication',array($this,'doAuthentication'));
		$this->getApplication()->attachEventHandler('OnEndRequest',array($this,'leave'));
		$this->getApplication()->attachEventHandler('OnAuthorization',array($this,'doAuthorization'));
		$this->_initialized=true;
	}
	
	private static function extractTicketFromCookie($context, $name)
	{

	}
	/**
	 * Performs authentication.
	 * This is the event handler attached to application's Authentication event.
	 * Do not call this method directly.
	 * @param mixed sender of the Authentication event
	 * @param mixed event parameter
	 */
	public function doAuthentication($sender,$param)
	{
		Prado::using('System.Util.TVarDumper');
//		echo TVarDumper::dump(__METHOD__,10,true);
	}
	/**
	 * Performs login redirect if authorization fails.
	 * This is the event handler attached to application's EndRequest event.
	 * Do not call this method directly.
	 * @param mixed sender of the event
	 * @param mixed event parameter
	 */
	public function leave($sender,$param)
	{
		Prado::using('System.Util.TVarDumper');
//		echo TVarDumper::dump(__METHOD__,10,true);
	}
	/**
	 * Performs authorization.
	 * This is the event handler attached to application's Authorization event.
	 * Do not call this method directly.
	 * @param mixed sender of the Authorization event
	 * @param mixed event parameter
	 */
	public function doAuthorization($sender,$param)
	{
		Prado::using('System.Util.TVarDumper');
//		echo TVarDumper::dump(__METHOD__,10,true);
	}
}
//public sealed class FormsAuthenticationModule : IHttpModule
//{
//     // Events
//     public event FormsAuthenticationEventHandler Authenticate;
//
//     // Methods
//     [SecurityPermission(SecurityAction.Demand, Unrestricted=true)]
//     public FormsAuthenticationModule();
//     public void Dispose();
//     private static FormsAuthenticationTicket
//ExtractTicketFromCookie(HttpContext context, string name, out bool
//cookielessTicket);
//     public void Init(HttpApplication app);
//     private void OnAuthenticate(FormsAuthenticationEventArgs e);
//     private void OnEnter(object source, EventArgs eventArgs);
//     private void OnLeave(object source, EventArgs eventArgs);
//     private static void Trace(string str);
//
//     // Fields
//     private FormsAuthenticationEventHandler _eventHandler;
//     private static bool _fAuthChecked;
//     private static bool _fAuthRequired;
//     private bool _fFormsInit;
//     private string _FormsName;
//     private string _LoginUrl;
//     private const string CONFIG_DEFAULT_COOKIE = ".ASPXAUTH";
//     private const string CONFIG_DEFAULT_LOGINURL = "login.aspx";
//}
?>