Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt docs for config #28

Merged
merged 3 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/enhancement-config-json
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 26 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<your-server>/<path-to-the-config>`). If the prop is not defined, the location will fallback to `https://<your-server>/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://<your-server>/<path-to-the-config>`)
- If none of the props (`configObject` or `configLocation`) is defined, the file picker has a `configLocation` of `https://<your-server>/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://<your-server>/<path-to-the-config>`). If the prop is not defined, the location will fallback to `https://<your-server>/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": "<owncloud-server>",
Expand All @@ -21,8 +30,20 @@ The config for authorization is provided via a json file. Location of the file c
"client_id": "<client-id>",
"response_type": "code",
"scope": "openid profile email"
},
}
}
}
```

### OAuth2 config
```json
{
"server": "<owncloud-server>",
"auth": {
"clientId": "<oauth2-client-id>",
"url": "<your-server>/index.php/apps/oauth2/api/v1/token",
"authUrl": "<your-server>/index.php/apps/oauth2/authorize"
}
}
```

## Install File picker package
Expand Down Expand Up @@ -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`.
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`.
6 changes: 3 additions & 3 deletions tests/unit/__snapshots__/filePicker.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`File picker renders list of resources 1`] = `
</div>
<div class="uk-text-meta">
0 B - Last modified
16 hours ago
10 hours ago
</div>
</div>
</div>
Expand All @@ -49,7 +49,7 @@ exports[`File picker renders list of resources 1`] = `
</div>
<div class="uk-text-meta">
1.3 MB - Last modified
16 hours ago
10 hours ago
</div>
</div>
</div>
Expand All @@ -68,7 +68,7 @@ exports[`File picker renders list of resources 1`] = `
<div filename="ownCloud Manual.pdf" class="file-row-name uk-text-truncate"><span role="button" class="uk-text-bold oc-cursor-pointer oc-file-name uk-padding-remove-left">ownCloud Manual</span><span class="uk-text-meta oc-file-extension">.pdf</span></div>
<div class="uk-text-meta">
5.8 MB - Last modified
16 hours ago
10 hours ago
</div>
</div>
</div>
Expand Down