Stud.IP  5.4
StudipAuthAbstract Class Reference
Inheritance diagram for StudipAuthAbstract:
StudipAuthIP StudipAuthLdap StudipAuthSSO StudipAuthStandard StudipAuthLdapReadAndBind StudipAuthCAS StudipAuthLTI StudipAuthOIDC StudipAuthShib

Public Member Functions

 __construct ($config=[])
 
 authenticateUser ($username, $password)
 
 getStudipUser ($username)
 
 doNewUserInit ($user)
 
 setUserDomains ($user)
 
 getUserDomains ()
 
 doDataMapping ($user)
 
 isMappedField ($name)
 
 verifyUsername ($username)
 
 isUsedUsername ($username)
 
 isAuthenticated ($username, $password)
 
 __isset ($offset)
 
 __set ($offset, $value)
 
 __get ($offset)
 
 __unset ($offset)
 

Static Public Member Functions

static getInstance ($plugin_name=false)
 
static isSSOEnabled ()
 
static isLoginEnabled ()
 
static CheckAuthentication ($username, $password)
 
static CheckUsername ($username)
 
static CheckField ($field_name, $plugin_name)
 
static CheckIPRange ()
 
static CheckIPRangeV4 ($ip, $range)
 
static CheckIPRangeV6 ($ip, $range)
 

Data Fields

 $error_msg
 
 $is_new_user = false
 
 $user_domains
 
 $user_data_mapping = null
 
 $plugin_name
 
 $error_head
 
 $show_login
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $config = [])

Constructor

you should use StudipAuthAbstract::GetInstance($plugin_name) to get a reference to a plugin object. Make sure the constructor in the base class is called when deriving your own plugin class, it assigns the settings from local.inc as members of the plugin each key of the $STUDIP_AUTH_CONFIG_<plugin name> array will become a member of the object

Parameters
array$config

Member Function Documentation

◆ __get()

__get (   $offset)

◆ __isset()

__isset (   $offset)

◆ __set()

__set (   $offset,
  $value 
)

◆ __unset()

__unset (   $offset)

◆ authenticateUser()

authenticateUser (   $username,
  $password 
)

authentication method

this method authenticates the passed username, it is used by StudipAuthAbstract::CheckAuthentication() if authentication succeeds it calls StudipAuthAbstract::doDataMapping() to map data fields if the authenticated user logs in for the first time it calls StudipAuthAbstract::doNewUserInit() to initialize the new user

Parameters
string$usernamethe username to check
string$passwordthe password to check
Returns
string if authentication succeeds the Stud.IP user , else false

◆ CheckAuthentication()

static CheckAuthentication (   $username,
  $password 
)
static

static method to check authentication in all plugins

if authentication fails in one plugin, the error message is stored and the next plugin is used if authentication succeeds, the uid element in the returned array will contain the Stud.IP user id

Parameters
string$usernamethe username to check
string$passwordthe password to check
Returns
array structure: array('uid'=>'string <Stud.IP user id>','error'=>'string <error message>="">','is_new_user'=>'bool')

◆ CheckField()

static CheckField (   $field_name,
  $plugin_name 
)
static

static method to check for a mapped field

this method checks in the plugin with the passed name, if the passed Stud.IP DB field is mapped to an external data source

Parameters
stringthe name of the db field must be in form '
<field name>="">'
stringthe name of the plugin to check
Returns
bool true if the field is mapped, else false

◆ CheckIPRange()

static CheckIPRange ( )
static

static method to check if ip address belongs to allowed range

Returns
bool true if the client ip address is within the valid range

◆ CheckIPRangeV4()

static CheckIPRangeV4 (   $ip,
  $range 
)
static
Parameters
$ipstring IPv4 adress
$rangearray assoc array with [start] & [end]
Returns
bool

◆ CheckIPRangeV6()

static CheckIPRangeV6 (   $ip,
  $range 
)
static
Parameters
$ipstring IPv6 address
$rangearray assoc array with [start] & [end]
Returns
bool

◆ CheckUsername()

static CheckUsername (   $username)
static

static method to check if passed username is used in external data sources

all plugins are checked, the error messages are stored and returned

Parameters
string$usernamethe username
Returns
array

◆ doDataMapping()

doDataMapping (   $user)

this method handles the data mapping

for each entry in $this->user_data_mapping the according callback will be invoked the return value of the callback method is then written to the db field, which is specified in the key of the array

private

Parameters
Userthe user object
Returns
bool

◆ doNewUserInit()

doNewUserInit (   $user)

initialize a new user

this method is invoked for one time, if a new user logs in ($this->is_new_user is true) place special treatment of new users here

private

Parameters
User$userthe user object

◆ getInstance()

static getInstance (   $plugin_name = false)
static

static method to instantiate and retrieve a reference to an object (singleton)

always use this method to instantiate a plugin object, it will ensure that only one object of each plugin will exist

Parameters
string$plugin_namename of plugin, if omitted an array with all plugin objects will be returned
Returns
mixed either a reference to the plugin with the passed name, or an array with references to all plugins

◆ getStudipUser()

getStudipUser (   $username)

method to retrieve the Stud.IP user id to a given username

private

Parameters
stringthe username
Returns
User the Stud.IP or false if an error occurs

◆ getUserDomains()

getUserDomains ( )

Get the user domains to assign to the current user.

◆ isAuthenticated()

isAuthenticated (   $username,
  $password 
)

method to check the authentication of a given username and a given password

abstract, MUST be realized

private

Parameters
stringthe username
stringthe password
Returns
bool true if authentication succeeds

◆ isLoginEnabled()

static isLoginEnabled ( )
static

static method to check if standard login is enabled

Returns
bool

◆ isMappedField()

isMappedField (   $name)

method to check, if a given db field is mapped by the plugin

private

Parameters
stringthe name of the db field (<table_name>.<field_name>)
Returns
bool true if the field is mapped

◆ isSSOEnabled()

static isSSOEnabled ( )
static

static method to check if SSO login is enabled

Returns
bool

◆ isUsedUsername()

isUsedUsername (   $username)

method to check, if username is used

abstract MUST be realized

private

Parameters
stringthe username
Returns
bool true if the username exists

◆ setUserDomains()

setUserDomains (   $user)

This method sets the user domains for the current user.

private

Parameters
Userthe user object

◆ verifyUsername()

verifyUsername (   $username)

method to eliminate bad characters in the given username

private

Parameters
stringthe username
Returns
string the username

Field Documentation

◆ $error_head

string $error_head

text, which precedes error message for the plugin

◆ $error_msg

string $error_msg

contains error message, if authentication fails

◆ $is_new_user

bool $is_new_user = false

indicates whether the authenticated user logs in for the first time

◆ $plugin_name

string $plugin_name

name of the plugin

name of the plugin (last part of class name) is set in the constructor

◆ $show_login

bool $show_login

toggles display of standard login

◆ $user_data_mapping

array $user_data_mapping = null

associative array with mapping for database fields

associative array with mapping for database fields, should be set in local.inc structure : array('

<field name>="">' => array( 'callback' => '<name of="" callback="" method="" used="" for="" data="" retrieval>="">', 'map_args' => '<arguments passed="" to="" callback="" method>="">'))

◆ $user_domains

array $user_domains

array of user domains to assign to each user, can be set in local.inc

public


The documentation for this class was generated from the following file: