From 7c680d589b95961548b15b5ec7cfa1d5662870ba Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 15 Apr 2021 12:07:07 +0200 Subject: [PATCH 1/3] Adapt docs for config --- docs/installation.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 94e95d9..42df391 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -9,9 +9,18 @@ geekdocFilePath: installation.md {{< toc >}} -## Setup authorization -The config for authorization is provided via a json file. Location of the file can be provided via a prop called `configLocation`. This requires full URL address (e.g. `https:///`). If the prop is not defined, the location will fallback to `https:///file-picker-config.json`. The config can point to both oauth2 and OIDC. You can take a look at the following example to see how OIDC can be defined: +## Setup authentication +The config for the server backend and authentication needs to be provided in json format. The full set of options is listed below in two examples. One for authentication with OAuth2 and one with OpenID Connect. +There are different ways of providing the config JSON to the file picker: +- As a JSON object via a prop called `configObject` +- As a JSON string via the same prop (`configObject`) +- As a URL via a prop called `configLocation`. This requires full URL address (e.g. `https:///`) +- If none of the props (`configObject` or `configLocation`) is defined, the file picker has a `configLocation` of `https:///file-picker-config.json` as fallback + +Location of the file can be provided via a prop called `configLocation`. This requires full URL address (e.g. `https:///`). If the prop is not defined, the location will fallback to `https:///file-picker-config.json`. The config can point to both oauth2 and OIDC. You can take a look at the following example to see how OIDC can be defined: + +### OpenID Connect config ```json { "server": "", @@ -21,8 +30,20 @@ The config for authorization is provided via a json file. Location of the file c "client_id": "", "response_type": "code", "scope": "openid profile email" - }, -} + } +} +``` + +### OAuth2 config +```json +{ + "server": "", + "auth": { + "clientId": "", + "url": "/index.php/apps/oauth2/api/v1/token", + "authUrl": "/index.php/apps/oauth2/authorize" + } +} ``` ## Install File picker package @@ -90,4 +111,4 @@ As described in [Getting Started]({{< ref "getting-started.md#components-of-the- - `location` - Location picker ## Pass bearer token -In case you already have a bearer token and want to skip the whole authorization process inside of the File picker, you can pass it to the component via prop called `bearerToken`. \ No newline at end of file +In case you already have a bearer token and want to skip the whole authorization process inside of the File picker, you can pass it to the component via prop called `bearerToken`. From 67382586c72ebd4305a43e15bb2fea80f01961cf Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 15 Apr 2021 12:08:13 +0200 Subject: [PATCH 2/3] Add PR url to changelog --- changelog/unreleased/enhancement-config-json | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/unreleased/enhancement-config-json b/changelog/unreleased/enhancement-config-json index fc3b76f..f824643 100644 --- a/changelog/unreleased/enhancement-config-json +++ b/changelog/unreleased/enhancement-config-json @@ -3,3 +3,4 @@ Enhancement: Allow string as configObject attribute The property/attribute "configObject" is now allowed to be a string. We'll parse it as JSON. https://github.com/owncloud/file-picker/pull/27 +https://github.com/owncloud/file-picker/pull/28 From 3f54f18043604bbf028bab0f96322580d3d909fc Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 15 Apr 2021 12:08:52 +0200 Subject: [PATCH 3/3] Update test snapshot (will be fixed in a separate PR) --- tests/unit/__snapshots__/filePicker.spec.js.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/__snapshots__/filePicker.spec.js.snap b/tests/unit/__snapshots__/filePicker.spec.js.snap index b1fd30a..bc24611 100644 --- a/tests/unit/__snapshots__/filePicker.spec.js.snap +++ b/tests/unit/__snapshots__/filePicker.spec.js.snap @@ -28,7 +28,7 @@ exports[`File picker renders list of resources 1`] = `
0 B - Last modified - 16 hours ago + 10 hours ago
@@ -49,7 +49,7 @@ exports[`File picker renders list of resources 1`] = `
1.3 MB - Last modified - 16 hours ago + 10 hours ago
@@ -68,7 +68,7 @@ exports[`File picker renders list of resources 1`] = `
ownCloud Manual.pdf
5.8 MB - Last modified - 16 hours ago + 10 hours ago