Class: BasicAuthentication
Source Location: /auth.inc.php
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Class Methods
method defaultErrorMessage [line 357]
void defaultErrorMessage(
)
|
|
method defaultOnAuthenticate [line 415]
void defaultOnAuthenticate(
)
|
|
method defaultPassword [line 303]
method defaultTitle [line 374]
method defaultUsername [line 339]
method Execute [line 441]
Executes the authentication and checks if the user has been authenticated or not. This method tries to perform the user authentication, if the user has not been already authenticated, requests the username/password using a browser dialog, but if the user has been authenticated, does nothing. If the event OnAuthenticate is assigned, the valid username/password will be provided by code if not, the Username/Password properties will be used to authenticate <?php
function PasswordProtectedPageBeforeShow($sender, $params)
{
//Before the page is shown, call Execute to force user authentication
$this->BasicAuthentication1->Execute();
}
?>
Tags:
method getErrorMessage [line 355]
string getErrorMessage(
)
|
|
Error message to show when the user is not authenticated, this is the string shown on the browser when the authentication fails Use this property to show an specific error message when the authentication cannot be performed due wrong username/password combinations are provided by the user. The error message will be shown on the top of a blank page in most browsers, but that depends on the browser. The default value for this property is "Unauthorized"
Tags:
method getOnAuthenticate [line 413]
mixed getOnAuthenticate(
)
|
|
Event fired after the user has entered username and password This event is fired when the component needs to authenticate the user by code. In $params['username'] you will get the username entered by the user In $params['password'] you will get the password entered by the user This event is the right place for you to write customize authentication code, you can, for example query a database to know if the username/password combination is valid. To allow the user access the page, simply return true, and return false if the input information is not valid <?php
function BasicAuthentication1Authenticate($sender, $params)
{
//You can use the Username and Password properties to automatically check for that
//But if you want to search in a list/database, you can use the OnAuthenticate event
if (($params['username']=='delphiforphp') && ($params['password']=='rules'))
{
return(true);
}
else return(false);
}
?>
Tags:
method getPassword [line 301]
Password to request to the user, the password entered by the user will be checked against the value of this property Use this property to specify a valid password the user will need to provide in order to access the page this component is located on. If you need to provide several valid passwords, check OnAuthenticate event as you can write there any validation code to the password sent by the user. Remember this password is stored in clear text in the .xml.php of your form, so you will need to protect properly such file against unauthorized access to prevent them get the password. <?php
function BasicAuthentication1Authenticate($sender, $params)
{
//You can use the Username and Password properties to automatically check for that
//But if you want to search in a list/database, you can use the OnAuthenticate event
if (($params['username']=='delphiforphp') && ($params['password']=='rules'))
{
return(true);
}
else return(false);
}
?>
Tags:
method getTitle [line 372]
Title of the authentication dialog to show the user When the browser tries to authenticate the user, in most cases will show a dialog requesting for username and password, and this property specifies the caption for such dialog, or part of it, depending on the browser. The default value is "Login", which will be fine for most cases.
Tags:
method getUsername [line 337]
Valid username to authenticate against the username entered by the user Use this property to specify a valid username the user will need to provide in order to access the page this component is located on. If you need to provide several valid usernames, check OnAuthenticate event as you can write there any validation code to the username sent by the user. Remember this property is stored in clear text in the .xml.php of your form, so you will need to protect properly such file against unauthorized access to prevent them get the username. <?php
function BasicAuthentication1Authenticate($sender, $params)
{
//You can use the Username and Password properties to automatically check for that
//But if you want to search in a list/database, you can use the OnAuthenticate event
if (($params['username']=='delphiforphp') && ($params['password']=='rules'))
{
return(true);
}
else return(false);
}
?>
Tags:
method setErrorMessage [line 356]
void setErrorMessage(
$value)
|
|
Parameters:
method setOnAuthenticate [line 414]
void setOnAuthenticate(
$value)
|
|
Parameters:
method setPassword [line 302]
void setPassword(
$value)
|
|
Parameters:
method setTitle [line 373]
method setUsername [line 338]
void setUsername(
$value)
|
|
Parameters:
Documentation generated on Sat, 13 Jun 2009 10:50:54 -0700 by phpDocumentor 1.4.1
|