Agile Toolkit  4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
Auth_Basic Class Reference
Inheritance diagram for Auth_Basic:
AbstractController AbstractObject Auth BasicAuth SQLAuth

Public Member Functions

 init ()
 allow ($user, $pass=null)
 setModel ($model, $login_field='email', $password_field='password')
 addEncryptionHook ($model)
 destroy ()
 get ($property=null, $default=null)
 getAll ()
 allowPage ($page)
 getAllowedPages ()
 isPageAllowed ($page)
 usePasswordEncryption ($method)
 encryptPassword ($password, $salt=null)
 check ()
 addInfo ($key, $val=null)
 isLoggedIn ()
 verifyCredintials ($user, $password)
 verifyCredentials ($user, $password)
 memorizeURL ()
 getURL ()
 loginRedirect ()
 loggedIn ($user=null, $pass=null)
 memorizeModel ()
 loginByID ($id)
 loginBy ($field, $value)
 login ($user)
 logout ()
 createForm ($page)
 showLoginForm ()
 processLogin ()

Data Fields

 $info = false
 $form = null
 $login_field = 'email'
 $password_field = 'password'

Protected Attributes

 $password_encryption = null
 $allowed_pages = array()

Detailed Description

A basic authentication class. Include inside your API or on a page. You may have multiple Auth instances. Supports 3rd party plugins.

http://agiletoolkit.org/doc/auth


Member Function Documentation

addEncryptionHook ( model)

Adds a hook to specified model which will encrypt password before save. Do not call on api->auth->model, because that model already has the hook

addInfo ( key,
val = null 
)

Add additional info to be stored in user session.

Reimplemented in SQLAuth.

allow ( user,
pass = null 
)

Create an array model and specify it for authentication as a quick way to get authentication working

allowPage ( page)

Specify page or array of pages which will exclude authentication. Add your registration page here or page containing terms and conditions

check ( )

Call this function to perform a check for logged in user. This will also display a login-form and will verify user's credential. If you want to handle log-in form on your own, use auth->isLoggedIn() to check and redirect user to a login page.

check() returns true if user have just logged in and will return "null" for requests when user continues to use his session. Use that to perform some calculation on log-in

createForm ( page)

Creates log-in form. Override if you want to use your own form. If you need to change template used by a log-in form, add template/default/page/login.html

destroy ( )

Removes object from parent and prevents it from renedring

Reimplemented from AbstractObject.

encryptPassword ( password,
salt = null 
)

Manually encrypt password

get ( property = null,
default = null 
)

Auth memorizes data about a logged-in user in session. You can either use this function to access that data or $auth->model (preferred) $auth->get('username') will always point to the login field value ofthe user regardless of how your field is named

getAll ( )
getURL ( )

Return originalally requested URL.

init ( )

Initialize object. Always call parent

This method is called for initialization

Reimplemented from AbstractObject.

Reimplemented in SQLAuth.

Returns if user is authenticated or not. For more info on user see auth->model

isPageAllowed ( page)
loggedIn ( user = null,
pass = null 
)

This function is always executed after successfull login through a normal means (login form or plugin)

It will create cache model data.

login ( user)

Manually Log in as specified users by using login name.

loginBy ( field,
value 
)

Manually Log in with specified condition

loginByID ( id)

Manually Log in as specified users. Will not perform password check or redirect

Rederect to page user tried to access before authentication was requested

logout ( )

Manually log out user

Store model in session data so that it can be retrieved faster

Memorize current URL. Called when the first unsuccessful check is executed.

Do not override this function.

setModel ( model,
login_field = 'email',
password_field = 'password' 
)

Specify user model

Do not override this function.

usePasswordEncryption ( method)

Specifies how password will be encrypted when stored. Some values are "sha256/salt", "md5", "rot13". If you don't call this, passwords will be stored in plain-text

verifyCredentials ( user,
password 
)

This function verifies username and password. Password must be supplied in plain text. Does not affect currently logged in user

verifyCredintials ( user,
password 
)

Reimplemented in SQLAuth.


Field Documentation

$allowed_pages = array() [protected]
$form = null
$info = false
$login_field = 'email'
$password_encryption = null [protected]
$password_field = 'password'

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations