| 1: | <?php |
| 2: | /* |
| 3: | * SimpleID |
| 4: | * |
| 5: | * Copyright (C) Kelvin Mo 2021-2025 |
| 6: | * |
| 7: | * This program is free software; you can redistribute it and/or |
| 8: | * modify it under the terms of the GNU General Public |
| 9: | * License as published by the Free Software Foundation; either |
| 10: | * version 2 of the License, or (at your option) any later version. |
| 11: | * |
| 12: | * This program is distributed in the hope that it will be useful, |
| 13: | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14: | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15: | * General Public License for more details. |
| 16: | * |
| 17: | * You should have received a copy of the GNU General Public |
| 18: | * License along with this program; if not, write to the Free |
| 19: | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20: | * |
| 21: | */ |
| 22: | |
| 23: | namespace SimpleID\Auth; |
| 24: | |
| 25: | use Psr\EventDispatcher\StoppableEventInterface; |
| 26: | use SimpleID\Models\User; |
| 27: | |
| 28: | /** |
| 29: | * An interface for classes that can return an authentication result. |
| 30: | * |
| 31: | */ |
| 32: | interface AuthResultInterface extends StoppableEventInterface { |
| 33: | /** |
| 34: | * Returns whether the authentication result was successful. |
| 35: | * |
| 36: | * If the result was successful, the authentication parameters can |
| 37: | * be obtained through other methods in this interface |
| 38: | * |
| 39: | * @return bool true if authentication was successful |
| 40: | */ |
| 41: | public function isAuthSuccessful(); |
| 42: | |
| 43: | /** |
| 44: | * Returns the authenticated user |
| 45: | * |
| 46: | * @return User the user, or null if no users can |
| 47: | * be authenticated |
| 48: | */ |
| 49: | public function getUser(): ?User; |
| 50: | |
| 51: | /** |
| 52: | * Returns the level of authentication achieved in this |
| 53: | * session |
| 54: | * |
| 55: | * @return int the authentication level |
| 56: | */ |
| 57: | public function getAuthLevel(): int; |
| 58: | |
| 59: | /** |
| 60: | * Returns the authentication context class references in relation |
| 61: | * to the current authentication session. |
| 62: | * |
| 63: | * @return array<string|int> an array of ACR values |
| 64: | */ |
| 65: | public function getACR(): array; |
| 66: | |
| 67: | /** |
| 68: | * Returns the name of the modules that used to |
| 69: | * authenticate the user in this session. |
| 70: | * |
| 71: | * @return array<string> an array of fully qualified class names of the modules |
| 72: | * involved in the authentication process |
| 73: | */ |
| 74: | public function getAuthModuleNames(): array; |
| 75: | } |
| 76: | |
| 77: | ?> |