From d39f5253bfedbb6167ba28c8628ca96709630d82 Mon Sep 17 00:00:00 2001 From: nilsteampassnet Date: Sun, 8 Sep 2024 19:14:14 +0200 Subject: [PATCH] 3.1.2 OAuth2 with Microsoft Entra is now available --- docs/features/authentication.md | 39 ++++ includes/config/include.php | 4 +- includes/core/load.js.php | 3 +- includes/core/login.js.php | 88 ++++++-- includes/core/login.oauth2.php | 44 ++++ includes/core/login.php | 37 +++- includes/core/login.sso.php | 16 -- includes/language/bulgarian.php | 1 + includes/language/catalan.php | 1 + includes/language/chinese.php | 1 + includes/language/czech.php | 1 + includes/language/dutch.php | 1 + includes/language/english.php | 3 +- includes/language/estonian.php | 1 + includes/language/french.php | 1 + includes/language/german.php | 139 ++++++------ includes/language/greek.php | 1 + includes/language/hungarian.php | 1 + includes/language/italian.php | 1 + includes/language/japanese.php | 1 + includes/language/norwegian.php | 1 + includes/language/polish.php | 1 + includes/language/portuguese.php | 1 + includes/language/portuguese_br.php | 1 + includes/language/romanian.php | 1 + includes/language/russian.php | 1 + includes/language/spanish.php | 1 + includes/language/swedish.php | 1 + includes/language/turkish.php | 1 + includes/language/ukrainian.php | 1 + includes/language/vietnamese.php | 1 + includes/tables_integrity.json | 34 +-- index.php | 15 +- pages/oauth.php | 56 +---- sources/identify.php | 200 ++++++++++++++---- sources/main.functions.php | 68 +++++- sources/main.queries.php | 47 ---- .../src/AzureAuthController.php | 158 +++++++++++++- .../performchecks/src/PerformChecks.php | 2 +- 39 files changed, 685 insertions(+), 290 deletions(-) create mode 100644 includes/core/login.oauth2.php delete mode 100644 includes/core/login.sso.php diff --git a/docs/features/authentication.md b/docs/features/authentication.md index 62e7fd0f6..3a69fc785 100755 --- a/docs/features/authentication.md +++ b/docs/features/authentication.md @@ -86,3 +86,42 @@ If disabled for a user, a red fingerprint symbol is shown in the users list. ![Settings tasks options](../_media/tp3_auth_mfa_3.png) + +## Oauth2 with Microsoft Entra (Azure) + +Users can authenticate through your Entra AD. The first time a user is authenticate in Teampass through oauth2, his account will be created in Teampass. + +👉 Notice that if the user has `group memberships` defined in AD and that those groups also exist in Teampass, then the user will be automatically associated to the matching groups (based upon their names). + +### Setting up at Entra side + +You need to create a new `App registration` for example called `Teampass`. + +This App will have an `Application (client) ID` and a `Directory (tenant) ID`. +A `Client secret` is also expected, not the `Secret ID` but the `Value` (the one that is only seen once). + +You will have to define a new `Redirect URIs` with the value provided from Teampass OAuth configuration page. +And it is suggested to use option `Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)` as `Supported account types`. + +Now define `API permissions` with next permissions: + +* `Microsoft Graph`: + * `email` with Type `Delegated` + * `Group.Read.All` with Type `Delegated` + * `Group.Read.All` with Type `Application` + * `offline_access` with Type `Delegated` + * `openid` with Type `Delegated` + * `profile` with Type `Delegated` + * `User.Read` with Type `Delegated` +* `Teampass`: + * `Read.All` with Type `Delegated` + +Don't forget to `Grant admin consent for Default Directory`. + +Finaly define the users allowaed to access this new Application + +### Setting up in Teampass + +Navigate to `OAuth` page from the administration, and provide the expected information. + +It is suggested to perform a test with a fake user. \ No newline at end of file diff --git a/includes/config/include.php b/includes/config/include.php index 3d7567c01..cd9f67993 100755 --- a/includes/config/include.php +++ b/includes/config/include.php @@ -28,7 +28,7 @@ define('TP_VERSION', '3.1.2'); define("UPGRADE_MIN_DATE", "1724862801"); -define('TP_VERSION_MINOR', '61'); +define('TP_VERSION_MINOR', '63'); define('TP_TOOL_NAME', 'Teampass'); define('TP_ONE_DAY_SECONDS', 86400); define('TP_ONE_WEEK_SECONDS', 604800); @@ -40,7 +40,7 @@ define('TP_COPYRIGHT', '2009-'.date('Y')); define('TP_ALLOWED_TAGS', '