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

Procedural File: authentication_api.php

Source Location: /core/authentication_api.php

Page Details

Authentication API

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

requires helper_api

[ Top ]


Globals
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 ]


Functions
auth_attempt_login  [line 178]

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.

Parameters:
string   $p_username:  a prepared username
string   $p_password:  a prepared password
bool   $p_perm_login:  whether to create a long-term cookie

API Tags:
Return:  indicates if authentication was successful
Access:  public


[ Top ]
auth_attempt_script_login  [line 250]

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

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

Parameters:
string   $p_username:  username
string   $p_password:  username

API Tags:
Return:  indicates if authentication was successful
Access:  public


[ Top ]
auth_automatic_logon_bypass_form  [line 317]

bool auth_automatic_logon_bypass_form( )

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


API Tags:
Access:  public


[ Top ]
auth_clear_cookies  [line 469]

bool auth_clear_cookies( )

Clear login cookies, return true if they were cleared


API Tags:
Return:  indicating whether cookies were cleared
Access:  public


[ Top ]
auth_does_password_match  [line 333]

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)

Parameters:
int   $p_user_id:  User id to check password against
string   $p_test_password:  Password

API Tags:
Return:  indicating whether password matches given the user id
Access:  public


[ 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

Parameters:
string   $p_return_page:  Page to redirect to following successful logon, defaults to current page

API Tags:
Access:  public


[ Top ]
auth_generate_confirm_hash  [line 433]

string auth_generate_confirm_hash( int $p_user_id  )

Generate a confirm_hash 12 character to valide the password reset request

Parameters:
int   $p_user_id:  user id

API Tags:
Return:  representing MD5 hash
Access:  public


[ Top ]
auth_generate_cookie_string  [line 495]

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


API Tags:
Return:  64 character cookie string
Access:  public


[ Top ]
auth_generate_random_password  [line 420]

string auth_generate_random_password( string $p_email  )

Generate a random 12 character password

Parameters:
string   $p_email:  unused

API Tags:
Return:  12 character random password
Access:  public

Information Tags:
Todo:  Review use of $p_email within mantis

[ Top ]
auth_generate_unique_cookie_string  [line 508]

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


API Tags:
Return:  64 character cookie string
Access:  public


[ Top ]
auth_get_current_user_cookie  [line 552]

string auth_get_current_user_cookie( )

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)


API Tags:
Return:  current user login cookie string
Access:  public


[ Top ]
auth_get_current_user_id  [line 759]

int auth_get_current_user_id( )

Retrieve user id of current user


API Tags:
Return:  user id
Access:  public


[ Top ]
auth_http_is_logout_pending  [line 835]

bool auth_http_is_logout_pending( )

API Tags:
Access:  public


[ Top ]
auth_http_prompt  [line 801]

void auth_http_prompt( )

API Tags:
Access:  public


[ Top ]
auth_http_set_logout_pending  [line 819]

void auth_http_set_logout_pending( bool $p_pending  )
Parameters:
bool   $p_pending: 

API Tags:
Access:  public


[ Top ]
auth_is_cookie_string_unique  [line 523]

bool auth_is_cookie_string_unique( string $p_cookie_string  )

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

Parameters:
string   $p_cookie_string: 

API Tags:
Return:  indicating whether cookie string is unique
Access:  public


[ Top ]
auth_is_cookie_valid  [line 715]

bool auth_is_cookie_valid( string $p_cookie_string  )

is cookie valid?

Parameters:
string   $p_cookie_string: 

API Tags:
Access:  public


[ Top ]
auth_is_user_authenticated  [line 91]

bool auth_is_user_authenticated( )

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


API Tags:
Access:  public


[ Top ]
auth_logout  [line 292]

void auth_logout( )

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

Returns true on success, false otherwise


API Tags:
Access:  public


[ Top ]
auth_prepare_password  [line 139]

string auth_prepare_password( string $p_password  )

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

Parameters:
string   $p_password: 

API Tags:
Return:  prepared password
Access:  public

Information Tags:
Todo:  when we rewrite authentication api for plugins, this should be merged with prepare_username and return some object

[ Top ]
auth_prepare_username  [line 107]

string auth_prepare_username( string $p_username  )

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

Parameters:
string   $p_username: 

API Tags:
Return:  prepared username
Access:  public

Information Tags:
Todo:  when we rewrite authentication api for plugins, this should be merged with prepare_password and return some object

[ Top ]
auth_process_plain_password  [line 386]

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

Parameters:
string   $p_password: 
string   $p_salt:  salt, defaults to null
string   $p_method:  logon method, defaults to null (use config login method)

API Tags:
Return:  processed password, maximum PASSLEN chars in length
Access:  public


[ Top ]
auth_reauthenticate  [line 613]

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).


API Tags:
Access:  public


[ Top ]
auth_reauthenticate_page  [line 645]

bool auth_reauthenticate_page( integer $p_user_id, string $p_username  )

Generate the intermediate authentication page.

Parameters:
integer   $p_user_id:  User ID
string   $p_username:  Username

API Tags:
Access:  public


[ Top ]
auth_set_cookies  [line 450]

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

Parameters:
int   $p_user_id:  user id
bool   $p_perm_login:  indicates whether to generate a long-term cookie

API Tags:
Access:  public


[ Top ]
auth_set_tokens  [line 596]

void auth_set_tokens( integer $p_user_id  )

Set authentication tokens for secure session.

Parameters:
integer   $p_user_id:  User ID

API Tags:
Access:  public


[ Top ]


Documentation generated on Sun, 05 Apr 2009 23:00:54 +0100 by phpDocumentor 1.4.1