Adding support for authentication w/ single tenant custom applications (#1094)

* Adding support for authentication with single tenant custom applications in OneDrive Business/Enterprise accounts.

When using a custom single tenant application the /common/ part on the authentication URLs needs to be replaced
by the tenant name. This can be configured on the azure_tenant_id setting, but this entry was being ignored unless
a custom azure_ad_endpoint was also set.

* Updated documentation to mention that, when configuring for Single Tenant Applications,
both the Tenant Name and Application ID must be included on the config file.

Co-authored-by: abraunegg <alex.braunegg@gmail.com>
This commit is contained in:
sebastiaopf 2020-10-10 01:39:04 -03:00 committed by GitHub
parent fed9a393a7
commit a3c4ba1b3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -474,6 +474,19 @@ The following are supported for pattern matching and exclusion rules:
**Note:** after changing the sync_list, you must perform a full re-synchronization by adding `--resync` to your existing command line - for example: `onedrive --synchronize --resync`
### Configuring the client for 'single tenant application' use
In some instances when using OneDrive Business Accounts, depending on the Azure organisational configuration, it will be necessary to configure the client as a 'single tenant application'.
To configure this, after creating the application on your Azure tenant, update the 'config' file with the tenant name (not the GUID) and the newly created Application ID, then this will be used for the authentication process.
```text
# skip_dir_strict_match = "false"
application_id = "your.application.id.guid"
# resync = "false"
# bypass_data_preservation = "false"
# azure_ad_endpoint = "xxxxxx"
azure_tenant_id = "your.azure.tenant.name"
# sync_business_shared_folders = "false"
```
### How to 'skip' directories from syncing?
There are several mechanisms available to 'skip' a directory from the sync process:
* Utilise 'skip_dir'

View file

@ -150,7 +150,15 @@ final class OneDriveApi
string azureConfigValue = cfg.getValueString("azure_ad_endpoint");
switch(azureConfigValue) {
case "":
log.log("Configuring Global Azure AD Endpoints");
if (tenantId == "common") {
log.log("Configuring Global Azure AD Endpoints");
} else {
log.log("Configuring Global Azure AD Endpoints - Single Tenant Application");
}
// Authentication
authUrl = globalAuthEndpoint ~ "/" ~ tenantId ~ "/oauth2/v2.0/authorize";
redirectUrl = globalAuthEndpoint ~ "/" ~ tenantId ~ "/oauth2/nativeclient";
tokenUrl = globalAuthEndpoint ~ "/" ~ tenantId ~ "/oauth2/v2.0/token";
break;
case "USL4":
log.log("Configuring Azure AD for US Government Endpoints");