Skip to content

Commit

Permalink
Merge pull request #28 from owncloud/config-docs
Browse files Browse the repository at this point in the history
Adapt docs for config
  • Loading branch information
kulmann authored Apr 15, 2021
2 parents 9d297ea + 3f54f18 commit 0a55f29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
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

0 comments on commit 0a55f29

Please sign in to comment.