Commit Graph

46 Commits

Author SHA1 Message Date
FusionPBX
30f6103dbb Update authentication.php 2025-04-17 16:32:12 -06:00
frytimo
e7393cc7c0 New Feature OpenID Connect (#7355)
* Refactor authentication to allow for OpenID Connect
The authentication class has been refactored to separate the `validate` function for the method `create_user_session`. This is needed for the OpenID Connect module to authenticate a user without going through the process of all authentication plugins. Only the function `check_user_cidr` has been rewritten to use a single loop instead of a double-loop.
Due to the fact that create_user_function is public, the $result associative array is checked to ensure the required fields are present and the UUID fields are valid UUIDs. Further checking could be done against the database to ensure the UUIDs exist but this has been suppressed at this time because database queries would be required.

* Database class modified to allow for login banners for OpenID Connect
The database class is responsible for creating the view for login. The OpenID application required banners to be present so that any OpenID Connect authentication mechanism could be used. Each banner displayed has the properties of: name, image, alt, and url. The name is the class name of the authentication plugin. This will match the action in the URL. The image is the image banner used for the login. The alt is the alternate text used for screen readers. Each authenticator is responsible for providing each of the field values.

* Added PHPDocs for the check_cidr function

* Add backwards compatibility for PHP versions below 8

* Remove get_banner_alt

* Update check_cidr to allow cidr array

* Update authentication.php

* Update functions.php

* Update authentication.php
2025-04-17 13:48:16 -06:00
frytimo
08001488f4 Allow namespace in auto loader (#7307)
* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove closing tag

* remove invalid method params

* remove closing tag

* remove closing tag

* Update auto_loader to load each class file in the project
Update the auto_loader class to use an include statement on each file in the project to load the class within the file. This will allow mismatched names within the file to be loaded and mapped according to the declaration instead of the filename. The class is then checked against the parsed classes from the PHP engine so that namespaces are available and mapped to the file they were declared in. An update was also made to the search algorithm used to find a file that was not already loaded by collapsing the array to have only valid matches to increase performance on a cache miss. Logging within the auto_loader has been moved to a function.
Multiple files were modified to allow the include statement. When the class has the `if(class_exists())` statement, the auto_loader is called to check for the class. This caused an infinite loop scenario so all wrappers have been removed. The auto_loader will now break the loop by directly modifying the internal classes array instead of trying to restart with the 'reload_classes' method.

- APCu is used to cache classes so any loading of the classes is done only once. To clear the APCu cache, restart php-fpm or call the auto_loader::clear_cache() function.
- Cache file is used when APCu is not available. To clear the cache remove it from the tmp folder or call the auto_loader::clear_cache() function.
- All classes must no longer have a class_exists wrapper to benefit from the performance boost.
- Classes should not be directly included when the auto_loader is used.

* remove include statement of class file

* Update destinations.php
2025-03-12 13:55:47 -06:00
Alex
f0bc1cfe33 Update contacts path (#7192)
* Update contacts path

* Update menu.php

* Update contact_edit.php

* Update contact_relation_edit.php

* Update config.php

* Update authentication.php

* Update database.php

* Update totp.php

* Update email.php
2024-12-06 11:55:41 -07:00
FusionPBX
b9a0cdf4e7 Update authentication.php 2024-10-06 10:32:57 -06:00
fusionate
ae15319487 Body Header User Image and Menu, Domain Selector, Contact Attachment improvements. 2024-09-28 16:37:36 -06:00
frytimo
9f6d828799 pass objects to authentication plugins when possible (#7123)
* pass objects to authentication plugins when possible
Pass the settings and authentication objects to the plugins to re-use existing objects

* Update authentication.php
2024-09-06 18:20:26 -06:00
frytimo
7b94e9434e fix authentication logging of cidr fail (#7120)
Correct variable name to use when logging a cidr failed login attempt

Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-09-05 09:30:22 -06:00
frytimo
a965c78735 fix empty session username (#7119) 2024-09-04 17:09:16 -06:00
frytimo
b529d2a535 regenerate the session after cidr check is complete and then log (#7117)
Logging after all checks are complete ensures the session ID is correct when logging it in the user_logs table

Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-09-04 12:06:09 -06:00
FusionPBX
313de4c6dc Update authentication.php
Empty the permissions before assigning permission to the user during the login process.
2024-04-20 22:00:29 -06:00
FusionPBX
09719c7f36 Update authentication, groups and permissions classes 2024-04-20 16:51:53 -06:00
FusionPBX
560a51cff7 Security - Update session validation and regenerate session id on login 2024-01-23 23:11:28 -07:00
FusionPBX
ee202cd61d Security - validate session 2024-01-22 14:20:28 -07:00
FusionPBX
2c5724c6ed Add new class methods and use them 2023-09-11 01:45:19 -06:00
fusionate
d24acf66bf Authentication: Updates to improve order compatibility. 2023-06-27 02:32:11 +00:00
fusionate
aa7def54a6 Authentication - Fix MFA when all methods are enabled. 2023-06-24 21:18:39 +00:00
fusionate
6bcc5aff5e Authentication: Added some polish, Cancel links, PHP 8.1 updates. 2023-06-23 00:14:07 +00:00
fusionate
3021f59431 Login: Restore authentication failed message. 2023-06-17 23:16:39 +00:00
markjcrane
8393701d13 Authentication reject on single plugin authorized false 2023-06-17 16:18:02 -06:00
markjcrane
6e7d274c5a Remove debug for authentication class. The validation method returns enough details. 2023-06-12 16:27:47 -06:00
fusionate
3dc38973e1 Authentication [Class] - Updates for PHP 8.1 2023-05-16 18:54:11 +00:00
FusionPBX
a4fddc7897 Update authentication.php 2023-05-12 20:30:17 -06:00
FusionPBX
d10e8bfdd4 Update authentication.php 2023-05-12 17:03:02 -06:00
FusionPBX
48fb933266 Remove static and use this. 2023-05-11 19:58:09 -06:00
FusionPBX
ffd9a2c4b5 [bug fix] get the domain from the username (#6691)
* [bug fix] get the domain from the username

When the URL domain doesn't match the user's domain

Authentication can use domain from the username.

username:
user@domain
2023-05-11 18:58:22 -06:00
fusionate
5badf55c3c Authentication [Class]: Updates for PHP 8.1 2023-05-11 13:40:17 +00:00
FusionPBX
a9fbb07a55 Use isset and empty 2023-05-10 21:58:00 -06:00
FusionPBX
0757c79271 Allow login with user email. 2023-05-06 14:40:21 -06:00
frytimo
fef8165be2 Frytimo pr patches for php8.1 (#6630)
* Passing null to parameter #2 ($string) of type string is deprecated

* Passing null to parameter #1 ($string) of type string is deprecated

* php 8.1 fixes

* php 8.1 fixes - replace strlen($var) > 0 with !empty($var)

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - strlower with null

* php 8.1 fixes - strreplace with null

* php 8.1 fixes - passing null to base64_decode

* php 8.1 fixes - check for false and check for null on $this->dir

* php 8.1 fixes - remove assignment of $db variable to modules object

* php 8.1 fixes - avoid sending null to substr

* php 8.1 fixes - change ${var} to {$var}

* php 8.1 fixes - check for null before preg_replace

* php 8.1 fixes - remove setting db variable on domains object

* php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null

* php 8.1 fixes - set empty string if $_REQUEST['show'] is not available

* php 8.1 fixes

* php 8.1 fixes - correct $_POST checking syntax

* php 8.1 fixes - correct $_POST variables

* php 8.1 fixes

* Use brackets consistently

* Update user_setting_edit.php

* Change to not empty

* Update device.php

* Update text.php

---------

Co-authored-by: Tim Fry <tim@voipstratus.com>
Co-authored-by: FusionPBX <markjcrane@gmail.com>
2023-05-05 10:46:37 -06:00
frytimo
69bd42af05 remove unneeded destruct methods as GC has higher performance (#6631)
Co-authored-by: Tim Fry <tim@voipstratus.com>
2023-04-27 20:18:53 -06:00
FusionPBX
ca0f5d5363 Use and set the SESSION username 2023-04-17 11:30:27 -06:00
markjcrane
00801b5b04 Add mutli-factor authentication. 2023-04-16 01:10:39 -06:00
FusionPBX
7c7112783c Automatically block multiple authentication failures 2022-04-25 22:52:20 -06:00
FusionPBX
ddb03b7722 Change the path from /app/user_logs to /core/user_logs. 2021-02-13 15:46:12 -07:00
FusionPBX
56d0811478 Update authentication.php 2020-02-20 01:01:23 -07:00
FusionPBX
98fd1aad80 Update authentication.php 2019-08-15 01:56:42 -06:00
FusionPBX
22f49f8ed2 Update authentication.php 2019-08-12 23:16:57 -06:00
FusionPBX
242660d470 Update authentication.php 2019-08-12 23:16:12 -06:00
FusionPBX
012a601527 Update authentication.php 2017-03-08 16:04:38 -07:00
FusionPBX
7c99289243 Update authentication.php
Update the session username if authorized is true.
2016-10-03 21:35:34 -06:00
FusionPBX
db9b088d86 Update authentication.php 2016-09-11 12:51:54 -06:00
FusionPBX
6ec74bc432 Update authentication.php
Make the database the default authentication plugin if the default setting -> authentication is not set.
2016-09-11 09:51:40 -06:00
FusionPBX
c91933ee5b Create authentication.php 2016-09-10 22:21:08 -06:00
FusionPBX
afdce9b55c Delete authentication.php
Wrong content added to this file that has no history so delete the file.
2016-09-10 22:20:10 -06:00
FusionPBX
8bc4637338 Create authentication.php
First commit in a series of commits adding a new authentication class.
2016-09-10 17:54:32 -06:00