jAuth

This is the main class for authentification process

package

jelix

subpackage

auth

Methods

_getConfig

_getConfig() 
static
deprecated
see \jAuth::getConfig()

_getDriver

_getDriver() 
static
deprecated
see \jAuth::getDriver()

Indicate if the password can be changed technically.

canChangePassword(string $login) : boolean
static

Not related to rights with jAcl2

since 1.6.21

Arguments

$login

string

the login of the user

Response

boolean

change a user password

changePassword(string $login, string $newpassword) : boolean
static

Arguments

$login

string

the login of the user

$newpassword

string

the new password (not encrypted)

Response

boolean

true if the change succeed

checkCookieToken

checkCookieToken() 
static

Create a new user object

createUserObject(string $login, string $password) : object
static

You should call this method if you want to create a new user. It returns an object, representing a user. Then you should fill its properties and give it to the saveNewUser method.

since 1.0b2

Arguments

$login

string

the user login

$password

string

the user password (not encrypted)

Response

object

the returned object depends on the driver

generateCookieToken

generateCookieToken( $login,  $password) 
static

Arguments

$login

$password

return the auth driver

getDriver() : \jIAuthDriver
static
since 1.2.10
Throws
\jException

Response

\jIAuthDriver

return the value of a parameter of the configuration of the current driver

getDriverParam(string $paramName) : string
static

Arguments

$paramName

string

Response

string

the value. null if it doesn't exist

generate a password with random letters, numbers and special characters

getRandomPassword(integer $length = 10, boolean $withoutSpecialChars = false) : string
static

Arguments

$length

integer

the length of the generated password

$withoutSpecialChars

boolean

(optional, default false) the generated password may be use this characters : !@#$%^&*?_,~

Response

string

the generated password

load user data

getUser(string $login) : object
static

This method returns an object, generated by the driver, and which contains data corresponding to the given login. This method should be called if you want to update data of a user. see updateUser method.

Arguments

$login

string

Response

object

the user

construct the user list

getUserList(string $pattern = '%') : array<mixed,object>
static

Arguments

$pattern

string

'' for all users

Response

array<mixed,object>

array of objects representing the users

return the user stored in the php session

getUserSession() : object
static

Response

object

the user data

Says if the user is connected

isConnected() : boolean
static

Response

boolean

Check if persistant session is enabled in config

isPersistant() : boolean
static

Response

boolean

true if persistant session in enabled

Load the configuration of authentification, stored in the auth plugin config

loadConfig(null $newconfig = null) : array
static
since 1.2.10
Throws
\jException

Arguments

$newconfig

null

Response

array

logout a user and delete the user in the php session

logout() 
static

remove a user send first AuthCanRemoveUser event, then if ok, send AuthRemoveUser and then remove the user.

removeUser(string $login) : boolean
static

Arguments

$login

string

the user login

Response

boolean

true if ok

Save a new user

saveNewUser(object $user) : object
static

if the saving has succeed, a AuthNewUser event is sent The given object should have been created by calling createUserObject method :

example :

  $user = jAuth::createUserObject('login','password');
  $user->email ='bla@foo.com';
  jAuth::saveNewUser($user);
 

the type of $user depends of the driver, so it can have other properties.

Arguments

$user

object

the user data

Response

object

the user (eventually, with additional data)

update user data

updateUser(object $user) : boolean
static

It send a AuthUpdateUser event if the saving has succeed. If you want to change the user password, you must use jAuth::changePassword method instead of jAuth::updateUser method.

The given object should have been created by calling getUser method. Example :

  $user = jAuth::getUser('login');
  $user->email ='bla@foo.com';
  jAuth::updateUser($user);
 

the type of $user depends of the driver, so it can have other properties.

Arguments

$user

object

user data

Response

boolean

true if the user has been updated

verify that the password correspond to the login

verifyPassword(string $login, string $password) : object|false
static

Arguments

$login

string

the login of the user

$password

string

the password to test (not encrypted)

Response

object|false

if ok, returns the user as object

Properties

config

config : 
static

Type(s)

driver

driver : \jIAuthDriver
static
var

Type(s)

\jIAuthDriver