Skip to content

Commit 0aeec2a

Browse files
committed
Fix few minor mistakes
1 parent 540c72f commit 0aeec2a

20 files changed

Lines changed: 66 additions & 67 deletions

docs/simplesamlphp-authsource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The only function you need to implement is the `login($username, $password)`-fun
4242
This function receives the username and password the user entered, and is expected to return the attributes of that user.
4343
If the username or password is incorrect, it should throw an error saying so:
4444

45-
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
45+
throw new \impleSAML\Error\Error('WRONGUSERPASS');
4646

4747
"[Implementing custom username/password authentication](./simplesamlphp-customauth)" describes how to implement username/password authentication using that base class.
4848

docs/simplesamlphp-customauth.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Create the file `modules/mymodule/lib/Auth/Source/MyAuth.php` with the following
4343
class sspmod_mymodule_Auth_Source_MyAuth extends sspmod_core_Auth_UserPassBase {
4444
protected function login($username, $password) {
4545
if ($username !== 'theusername' || $password !== 'thepassword') {
46-
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
46+
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
4747
}
4848
return array(
4949
'uid' => array('theusername'),
@@ -64,7 +64,7 @@ Some things to note:
6464
- The `login` function receives the username and password the user enters.
6565
It is expected to authenticate the user.
6666
If the username or password is correct, it must return a set of attributes for the user.
67-
Otherwise, it must throw the `SimpleSAML_Error_Error('WRONGUSERPASS');` exception.
67+
Otherwise, it must throw the `\SimpleSAML\Error\Error('WRONGUSERPASS');` exception.
6868

6969
- Attributes are returned as an associative array of `name => values` pairs.
7070
All attributes can have multiple values, so the values are always stored in an array.
@@ -187,7 +187,7 @@ The complete class file should look like this:
187187

188188
protected function login($username, $password) {
189189
if ($username !== $this->username || $password !== $this->password) {
190-
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
190+
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
191191
}
192192
return array(
193193
'uid' => array($this->username),
@@ -323,14 +323,14 @@ The class follows:
323323
if (!$row) {
324324
/* User not found. */
325325
SimpleSAML\Logger::warning('MyAuth: Could not find user ' . var_export($username, TRUE) . '.');
326-
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
326+
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
327327
}
328328

329329
/* Check the password. */
330330
if (!$this->checkPassword($row['password_hash'], $password)) {
331331
/* Invalid password. */
332332
SimpleSAML\Logger::warning('MyAuth: Wrong password for user ' . var_export($username, TRUE) . '.');
333-
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
333+
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
334334
}
335335

336336
/* Create the attribute array of the user. */

docs/simplesamlphp-errorhandling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ If it is unable to convert the exception, it will return a generic SAML 2 error
7878

7979
To return a specific SAML 2 error, you should:
8080

81-
* Create a new exception class for your error. This exception class must subclass `SimpleSAML_Error_Exception`.
81+
* Create a new exception class for your error. This exception class must subclass `\SimpleSAML\Error\Exception`.
8282
* Add that exception to the list in `fromException()`.
8383
* Consider adding the exception to `toException()` in the same file. (See the next section.)
8484

docs/simplesamlphp-maintenance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ example configuration of different metadata sources in use at the same time:
178178
```
179179

180180
You may also implement your own metadata storage handler, in a very similar way to how you would implement
181-
your own session handler. Your class **must** extend the `SimpleSAML_Metadata_MetaDataStorageSource` class
181+
your own session handler. Your class **must** extend the `\SimpleSAML\Metadata\MetaDataStorageSource` class
182182
and override the methods needed to change the backend used. This class **must** also be located in the
183183
`lib/MetadataStore/` directory of your custom module.
184184

@@ -190,7 +190,7 @@ module is named _mymodule_ and your class is named _MyMetadataHandler_, you shou
190190
<?php
191191
namespace SimpleSAML\Module\mymodule\MetadataStore;
192192
193-
class MyMetadataHandler extends SimpleSAML_Metadata_MetaDataStorageSource
193+
class MyMetadataHandler extends \SimpleSAML\Metadata\MetaDataStorageSource
194194
{
195195
...
196196
```

docs/simplesamlphp-nostate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Debugging "State Information Lost" errors
22
=========================================
33

4-
**"State Information Lost"** (`SimpleSAML_Error_NoState: NOSTATE`)
4+
**"State Information Lost"** (`\SimpleSAML\Error\NoState: NOSTATE`)
55

66
This is one of the most common errors that you can encounter when configuring
77
SimpleSAMLphp. Unfortunately, it is also a generic error that can have many

docs/simplesamlphp-sp-migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ This is a quick overview of the API:
155155
Generally, if you have:
156156

157157
$config = \SimpleSAML\Configuration::getInstance();
158-
$session = \SimpleSAML_Session::getSessionFromRequest();
158+
$session = \SimpleSAML\Session::getSessionFromRequest();
159159

160160
you should replace it with this single line:
161161

docs/simplesamlphp-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ If you need to make more extensive customizations to the base template, you shou
128128

129129
cp templates/base.twig modules/mymodule/themes/fancytheme/default/
130130

131-
Any references to `$this->data['baseurlpath']` in old-style templates can be replaced with `{{baseurlpath}}` in Twig templates. Likewise, references to `SimpleSAML_Module::getModuleURL()` can be replaced with `{{baseurlpath}}module.php/mymodule/...`
131+
Any references to `$this->data['baseurlpath']` in old-style templates can be replaced with `{{baseurlpath}}` in Twig templates. Likewise, references to `\SimpleSAML\Module::getModuleURL()` can be replaced with `{{baseurlpath}}module.php/mymodule/...`
132132

133133
See the [Twig documentation](https://twig.symfony.com/doc/1.x/templates.html) for more information on using variables and expressions in Twig templates, and the SimpleSAMLphp wiki for [our conventions](https://github.com/simplesamlphp/simplesamlphp/wiki/Twig-conventions).
134134

lib/SimpleSAML/Auth/ProcessingChain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private static function parseFilter($config, $priority)
151151
throw new \Exception('Authentication processing filter without name given.');
152152
}
153153

154-
$className = \SimpleSAML\Module::resolveClass($config['class'], 'Auth\Process', '\SimpleSAML\Auth\ProcessingFilter');
154+
$className = \SimpleSAML\Module::resolveClass($config['class'], 'Auth_Process', '\SimpleSAML\Auth\ProcessingFilter');
155155
$config['%priority'] = $priority;
156156
unset($config['class']);
157157
return new $className($config, null);

lib/SimpleSAML/Auth/Source.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ private static function parseAuthSource($authId, $config)
303303

304304
try {
305305
// Check whether or not there's a factory responsible for instantiating our Auth Source instance
306-
$factoryClass = \SimpleSAML\Module::resolveClass($id, 'Auth\Source\Factory', '\SimpleSAML\Auth\SourceFactory');
306+
$factoryClass = \SimpleSAML\Module::resolveClass($id, 'Auth_Source_Factory', '\SimpleSAML\Auth\SourceFactory');
307307

308308
/** @var SourceFactory $factory */
309309
$factory = new $factoryClass;
310310
$authSource = $factory->create($info, $config);
311311
} catch (\Exception $e) {
312312
// If not, instantiate the Auth Source here
313-
$className = \SimpleSAML\Module::resolveClass($id, 'Auth\Source', '\SimpleSAML\Auth\Source');
313+
$className = \SimpleSAML\Module::resolveClass($id, 'Auth_Source', '\SimpleSAML\Auth\Source');
314314
$authSource = new $className($info, $config);
315315
}
316316

lib/SimpleSAML/Error/Exception.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class Exception extends \Exception
4040
*
4141
* @param string $message Exception message
4242
* @param int $code Error code
43-
* @param Exception|null $cause The cause of this exception.
43+
* @param \Exception|null $cause The cause of this exception.
4444
*/
45-
public function __construct($message, $code = 0, Exception $cause = null)
45+
public function __construct($message, $code = 0, \Exception $cause = null)
4646
{
4747
assert(is_string($message));
4848
assert(is_int($code));
@@ -60,11 +60,11 @@ public function __construct($message, $code = 0, Exception $cause = null)
6060
/**
6161
* Convert any exception into a \SimpleSAML\Error\Exception.
6262
*
63-
* @param Exception $e The exception.
63+
* @param \Exception $e The exception.
6464
*
6565
* @return Exception The new exception.
6666
*/
67-
public static function fromException(Exception $e)
67+
public static function fromException(\Exception $e)
6868
{
6969
if ($e instanceof Exception) {
7070
return $e;
@@ -76,9 +76,9 @@ public static function fromException(Exception $e)
7676
/**
7777
* Load the backtrace from the given exception.
7878
*
79-
* @param Exception $exception The exception we should fetch the backtrace from.
79+
* @param \Exception $exception The exception we should fetch the backtrace from.
8080
*/
81-
protected function initBacktrace(Exception $exception)
81+
protected function initBacktrace(\Exception $exception)
8282
{
8383
$this->backtrace = array();
8484

0 commit comments

Comments
 (0)