Skip to content
Snippets Groups Projects
Unverified Commit 8d495d6f authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Merge branch 'master' into Xnew-ui-fixes

parents 668836b3 394e1be2
No related branches found
No related tags found
No related merge requests found
Implementing custom username/password authentication Implementing custom username/password authentication
==================================================== ====================================================
This is a step-by-step guide for creating a custom username/password [authentication source](./simplesamlphp-authsource) for SimpleSAMLphp. This is a step-by-step guide for creating a custom username/password [authentication source](./simplesamlphp-authsource.md) for SimpleSAMLphp.
An authentication source is responsible for authenticating the user, typically by getting a username and password, and looking it up in some sort of database. An authentication source is responsible for authenticating the user, typically by getting a username and password, and looking it up in some sort of database.
<!-- {{TOC}} --> <!-- {{TOC}} -->
...@@ -9,7 +9,7 @@ An authentication source is responsible for authenticating the user, typically b ...@@ -9,7 +9,7 @@ An authentication source is responsible for authenticating the user, typically b
Create a custom module Create a custom module
---------------------- ----------------------
All custom code for SimpleSAMLphp should be contained in a [module](./simplesamlphp-modules). All custom code for SimpleSAMLphp should be contained in a [module](./simplesamlphp-modules.md).
This ensures that you can upgrade your SimpleSAMLphp installation without overwriting your own code. This ensures that you can upgrade your SimpleSAMLphp installation without overwriting your own code.
In this example, we will call the module `mymodule`. In this example, we will call the module `mymodule`.
It will be located under `modules/mymodule`. It will be located under `modules/mymodule`.
...@@ -214,7 +214,7 @@ Note that we have updated the username & password to "theconfigusername" and "th ...@@ -214,7 +214,7 @@ Note that we have updated the username & password to "theconfigusername" and "th
A more complete example - custom database authentication A more complete example - custom database authentication
-------------------------------------------------------- --------------------------------------------------------
The [sqlauth:SQL](./sqlauth:sql) authentication source can do simple authentication against SQL databases. The [sqlauth:SQL](../modules/sqlauth/docs/sql.md) authentication source can do simple authentication against SQL databases.
However, in some cases it cannot be used, for example because the database layout is too complex, or because the password validation routines cannot be implemented in SQL. However, in some cases it cannot be used, for example because the database layout is too complex, or because the password validation routines cannot be implemented in SQL.
What follows is an example of an authentication source that fetches an user from a database, and validates the password using a custom function. What follows is an example of an authentication source that fetches an user from a database, and validates the password using a custom function.
......
...@@ -134,7 +134,8 @@ class LDAP ...@@ -134,7 +134,8 @@ class LDAP
// Enable TLS, if needed // Enable TLS, if needed
if (stripos($hostname, "ldaps:") === false && $enable_tls) { if (stripos($hostname, "ldaps:") === false && $enable_tls) {
if (!@ldap_start_tls($this->ldap)) { if (!@ldap_start_tls($this->ldap)) {
throw $this->makeException('Library - LDAP __construct(): Unable to force TLS', ERR_INTERNAL); throw $this->makeException('Library - LDAP __construct():'.
' Unable to force TLS', ERR_INTERNAL);
} }
} }
} }
...@@ -361,8 +362,8 @@ class LDAP ...@@ -361,8 +362,8 @@ class LDAP
return null; return null;
} else { } else {
// Zero hits not allowed // Zero hits not allowed
throw $this->makeException('Library - LDAP searchfordn(): LDAP search returned zero entries for filter \'('. throw $this->makeException('Library - LDAP searchfordn(): LDAP search returned zero entries for'.
join(' | ', $attribute).' = '.$value.')\' on base(s) \'('.join(' & ', $bases).')\'', 2); ' filter \'('.join(' | ', $attribute).' = '.$value.')\' on base(s) \'('.join(' & ', $bases).')\'', 2);
} }
} }
......
...@@ -322,7 +322,7 @@ class SAMLBuilder ...@@ -322,7 +322,7 @@ class SAMLBuilder
* @param bool $indexed Whether the endpoints should be indexed. * @param bool $indexed Whether the endpoints should be indexed.
* *
* @return array An array of endpoint objects, * @return array An array of endpoint objects,
* either \SAML2\XML\md\EndpointType or \SAML2\XML\md\IndexedEndpointType. * either \SAML2\XML\md\EndpointType or \SAML2\XML\md\IndexedEndpointType.
*/ */
private static function createEndpoints(array $endpoints, $indexed) private static function createEndpoints(array $endpoints, $indexed)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment