CoreAPI
[ class tree: CoreAPI ] [ index: CoreAPI ] [ all elements ]

Procedural File: authentication_api.php

Source Location: /core/authentication_api.php



Page Details:

Authentication API



Tags:

copyright:  Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
copyright:  Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
link:  http://www.mantisbt.org


Includes:

require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'gpc_api.php') [line 29]
requires helper_api




array $g_cache_anonymous_user_cookie_string [line 41]

Default value:   null


[ Top ]



array $g_cache_cookie_valid [line 47]

Default value:   null


[ Top ]



array $g_cache_current_user_id [line 53]

Default value:   null


[ Top ]



array $g_script_login_cookie [line 35]

Default value:   null


[ Top ]






auth_attempt_login [line 179]

bool auth_attempt_login( string $p_username, string $p_password, [bool $p_perm_login = false])

Attempt to login the user with the given password

If the user fails validation, false is returned If the user passes validation, the cookies are set and true is returned. If $p_perm_login is true, the long-term cookie is created.




Tags:

return:  indicates if authentication was successful
access:  public


Parameters

string   $p_username   a prepared username
string   $p_password   a prepared password
bool   $p_perm_login   whether to create a long-term cookie
[ Top ]



auth_attempt_script_login [line 256]

bool auth_attempt_script_login( string $p_username, [string $p_password = null])

Allows scripts to login using a login name or ( login name + password )



Tags:

return:  indicates if authentication was successful
access:  public


Parameters

string   $p_username   username
string   $p_password   username
[ Top ]



auth_automatic_logon_bypass_form [line 323]

bool auth_automatic_logon_bypass_form( )

Identicates whether to bypass logon form e.g. when using http auth



Tags:

access:  public


[ Top ]



auth_clear_cookies [line 475]

bool auth_clear_cookies( )

Clear login cookies, return true if they were cleared



Tags:

return:  indicating whether cookies were cleared
access:  public


[ Top ]



auth_does_password_match [line 339]

bool auth_does_password_match( int $p_user_id, string $p_test_password)

Return true if the password for the user id given matches the given

password (taking into account the global login method)




Tags:

return:  indicating whether password matches given the user id
access:  public


Parameters

int   $p_user_id   User id to check password against
string   $p_test_password   Password
[ Top ]



auth_ensure_user_authenticated [line 64]

void auth_ensure_user_authenticated( [string $p_return_page = ''])

Check that there is a user logged-in and authenticated

If the user's account is disabled they will be logged out If there is no user logged in, redirect to the login page If parameter is given it is used as a URL to redirect to following successful login. If none is given, the URL of the current page is used




Tags:

access:  public


Parameters

string   $p_return_page   Page to redirect to following successful logon, defaults to current page
[ Top ]



auth_generate_confirm_hash [line 439]

string auth_generate_confirm_hash( int $p_user_id)

Generate a confirm_hash 12 character to valide the password reset request



Tags:

return:  representing MD5 hash
access:  public


Parameters

int   $p_user_id   user id
[ Top ]



auth_generate_cookie_string [line 501]

string auth_generate_cookie_string( )

Generate a string to use as the identifier for the login cookie

It is not guaranteed to be unique and should be checked The string returned should be 64 characters in length




Tags:

return:  64 character cookie string
access:  public


[ Top ]



auth_generate_random_password [line 426]

string auth_generate_random_password( string $p_email)

Generate a random 12 character password



Tags:

return:  12 character random password
todo:  Review use of $p_email within mantis
access:  public


Parameters

string   $p_email   unused
[ Top ]



auth_generate_unique_cookie_string [line 513]

string auth_generate_unique_cookie_string( )

Generate a UNIQUE string to use as the identifier for the login cookie

The string returned should be 64 characters in length




Tags:

return:  64 character cookie string
access:  public


[ Top ]



auth_get_current_user_cookie [line 558]

string auth_get_current_user_cookie( [boolean $p_login_anonymous = true])

Return the current user login cookie string,

note that the cookie cached by a script login superceeds the cookie provided by the browser. This shouldn't normally matter, except that the password verification uses this routine to bypass the normal authentication, and can get confused when a normal user logs in, then runs the verify script. the act of fetching config variables may get the wrong userid. if no user is logged in and anonymous login is enabled, returns cookie for anonymous user otherwise returns '' (an empty string)




Tags:

return:  current user login cookie string
access:  public


Parameters

boolean   $p_login_anonymous   auto-login anonymous user
[ Top ]



auth_get_current_user_id [line 775]

int auth_get_current_user_id( )

Retrieve user id of current user



Tags:

return:  user id
access:  public


[ Top ]



auth_http_is_logout_pending [line 851]

bool auth_http_is_logout_pending( )



Tags:

access:  public


[ Top ]



auth_http_prompt [line 817]

void auth_http_prompt( )



Tags:

access:  public


[ Top ]



auth_http_set_logout_pending [line 835]

void auth_http_set_logout_pending( bool $p_pending)



Tags:

access:  public


Parameters

bool   $p_pending  
[ Top ]



auth_is_cookie_string_unique [line 528]

bool auth_is_cookie_string_unique( string $p_cookie_string)

Return true if the cookie login identifier is unique, false otherwise



Tags:

return:  indicating whether cookie string is unique
access:  public


Parameters

string   $p_cookie_string  
[ Top ]



auth_is_cookie_valid [line 731]

bool auth_is_cookie_valid( string $p_cookie_string)

is cookie valid?



Tags:

access:  public


Parameters

string   $p_cookie_string  
[ Top ]



auth_is_user_authenticated [line 92]

bool auth_is_user_authenticated( [boolean 0 = auto-login anonymous user])

Return true if there is a currently logged in and authenticated user, false otherwise



Tags:

access:  public


Parameters

boolean   0   auto-login anonymous user
[ Top ]



auth_logout [line 298]

void auth_logout( )

Logout the current user and remove any remaining cookies from their browser

Returns true on success, false otherwise




Tags:

access:  public


[ Top ]



auth_prepare_password [line 140]

string auth_prepare_password( string $p_password)

prepare/override the password provided from logon form (if necessary)



Tags:

return:  prepared password
todo:  when we rewrite authentication api for plugins, this should be merged with prepare_username and return some object
access:  public


Parameters

string   $p_password  
[ Top ]



auth_prepare_username [line 108]

string auth_prepare_username( string $p_username)

prepare/override the username provided from logon form (if necessary)



Tags:

return:  prepared username
todo:  when we rewrite authentication api for plugins, this should be merged with prepare_password and return some object
access:  public


Parameters

string   $p_username  
[ Top ]



auth_process_plain_password [line 392]

string auth_process_plain_password( string $p_password, [string $p_salt = null], [string $p_method = null])

Encrypt and return the plain password given, as appropriate for the current global login method.

When generating a new password, no salt should be passed in. When encrypting a password to compare to a stored password, the stored password should be passed in as salt. If the auth method is CRYPT then crypt() will extract the appropriate portion of the stored password as its salt




Tags:

return:  processed password, maximum PASSLEN chars in length
access:  public


Parameters

string   $p_password  
string   $p_salt   salt, defaults to null
string   $p_method   logon method, defaults to null (use config login method)
[ Top ]



auth_reauthenticate [line 619]

bool auth_reauthenticate( )

Check for authentication tokens, and display re-authentication page if needed.

Currently, if using BASIC or HTTP authentication methods, or if logged in anonymously, this function will always "authenticate" the user (do nothing).




Tags:

access:  public


[ Top ]



auth_reauthenticate_page [line 651]

bool auth_reauthenticate_page( integer $p_user_id, string $p_username)

Generate the intermediate authentication page.



Tags:

access:  public


Parameters

integer   $p_user_id   User ID
string   $p_username   Username
[ Top ]



auth_set_cookies [line 456]

void auth_set_cookies( int $p_user_id, [bool $p_perm_login = false])

Set login cookies for the user

If $p_perm_login is true, a long-term cookie is created




Tags:

access:  public


Parameters

int   $p_user_id   user id
bool   $p_perm_login   indicates whether to generate a long-term cookie
[ Top ]



auth_set_tokens [line 602]

void auth_set_tokens( integer $p_user_id)

Set authentication tokens for secure session.



Tags:

access:  public


Parameters

integer   $p_user_id   User ID
[ Top ]



Documentation generated on Sun, 12 Dec 2010 23:50:06 +0900 by phpDocumentor 1.4.3
inserted by FC2 system