Skip to content

Commit

Permalink
docs: adjust docs for namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed May 31, 2018
1 parent 1218be5 commit 116c706
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/simplesamlphp-authsource.md
Expand Up @@ -42,7 +42,7 @@ The only function you need to implement is the `login($username, $password)`-fun
This function receives the username and password the user entered, and is expected to return the attributes of that user.
If the username or password is incorrect, it should throw an error saying so:

throw new SimpleSAML_Error_Error('WRONGUSERPASS');
throw new \impleSAML\Error\Error('WRONGUSERPASS');

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

Expand Down
10 changes: 5 additions & 5 deletions docs/simplesamlphp-customauth.md
Expand Up @@ -43,7 +43,7 @@ Create the file `modules/mymodule/lib/Auth/Source/MyAuth.php` with the following
class sspmod_mymodule_Auth_Source_MyAuth extends sspmod_core_Auth_UserPassBase {
protected function login($username, $password) {
if ($username !== 'theusername' || $password !== 'thepassword') {
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
}
return array(
'uid' => array('theusername'),
Expand All @@ -64,7 +64,7 @@ Some things to note:
- The `login` function receives the username and password the user enters.
It is expected to authenticate the user.
If the username or password is correct, it must return a set of attributes for the user.
Otherwise, it must throw the `SimpleSAML_Error_Error('WRONGUSERPASS');` exception.
Otherwise, it must throw the `\SimpleSAML\Error\Error('WRONGUSERPASS');` exception.

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

protected function login($username, $password) {
if ($username !== $this->username || $password !== $this->password) {
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
}
return array(
'uid' => array($this->username),
Expand Down Expand Up @@ -323,14 +323,14 @@ The class follows:
if (!$row) {
/* User not found. */
SimpleSAML\Logger::warning('MyAuth: Could not find user ' . var_export($username, TRUE) . '.');
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
}

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

/* Create the attribute array of the user. */
Expand Down
2 changes: 1 addition & 1 deletion docs/simplesamlphp-errorhandling.md
Expand Up @@ -78,7 +78,7 @@ If it is unable to convert the exception, it will return a generic SAML 2 error

To return a specific SAML 2 error, you should:

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

Expand Down
4 changes: 2 additions & 2 deletions docs/simplesamlphp-maintenance.md
Expand Up @@ -178,7 +178,7 @@ example configuration of different metadata sources in use at the same time:
```

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

Expand All @@ -190,7 +190,7 @@ module is named _mymodule_ and your class is named _MyMetadataHandler_, you shou
<?php
namespace SimpleSAML\Module\mymodule\MetadataStore;
class MyMetadataHandler extends SimpleSAML_Metadata_MetaDataStorageSource
class MyMetadataHandler extends \SimpleSAML\Metadata\MetaDataStorageSource
{
...
```
Expand Down
2 changes: 1 addition & 1 deletion docs/simplesamlphp-nostate.md
@@ -1,7 +1,7 @@
Debugging "State Information Lost" errors
=========================================

**"State Information Lost"** (`SimpleSAML_Error_NoState: NOSTATE`)
**"State Information Lost"** (`\SimpleSAML\Error\NoState: NOSTATE`)

This is one of the most common errors that you can encounter when configuring
SimpleSAMLphp. Unfortunately, it is also a generic error that can have many
Expand Down
2 changes: 1 addition & 1 deletion docs/simplesamlphp-sp-migration.md
Expand Up @@ -155,7 +155,7 @@ This is a quick overview of the API:
Generally, if you have:

$config = \SimpleSAML\Configuration::getInstance();
$session = \SimpleSAML_Session::getSessionFromRequest();
$session = \SimpleSAML\Session::getSessionFromRequest();

you should replace it with this single line:

Expand Down
2 changes: 1 addition & 1 deletion docs/simplesamlphp-theming.md
Expand Up @@ -128,7 +128,7 @@ If you need to make more extensive customizations to the base template, you shou

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

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/...`
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/...`

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

Expand Down

0 comments on commit 116c706

Please sign in to comment.