ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
AdminPassword.php
Go to the documentation of this file.
1<?php
2
10
11
18 public function __construct($info, $config) {
19 assert('is_array($info)');
20 assert('is_array($config)');
21
22 // Call the parent constructor first, as required by the interface
23 parent::__construct($info, $config);
24
25 $this->setForcedUsername("admin");
26 }
27
28
42 protected function login($username, $password) {
43 assert('is_string($username)');
44 assert('is_string($password)');
45
47 $adminPassword = $config->getString('auth.adminpassword', '123');
48 if ($adminPassword === '123') {
49 // We require that the user changes the password
50 throw new SimpleSAML_Error_Error('NOTSET');
51 }
52
53 if ($username !== "admin") {
54 throw new SimpleSAML_Error_Error('WRONGUSERPASS');
55 }
56
57 if (!SimpleSAML\Utils\Crypto::pwValid($adminPassword, $password)) {
58 throw new SimpleSAML_Error_Error('WRONGUSERPASS');
59 }
60
61 return array('user' => array('admin'));
62 }
63
64}
An exception for terminatinating execution or to throw for unit testing.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
login($username, $password)
Attempt to log in using the given username and password.
__construct($info, $config)
Constructor for this authentication source.
setForcedUsername($forcedUsername)
Set forced username.
$info
Definition: index.php:5
Attribute-related utility methods.
$password
Definition: pwgen.php:17