@luigi-project/plugin-auth-oidc 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ meta -->
|
|
|
17
17
|
|
|
18
18
|
## Overview
|
|
19
19
|
|
|
20
|
-
This
|
|
20
|
+
This [authorization plugin](https://github.com/SAP/luigi/tree/master/plugins/auth/public/auth-oidc) contains a library that allows your application to extend the [Luigi framework](https://github.com/SAP/luigi/tree/master/core) with an OpenID Connect authorization provider.
|
|
21
21
|
Further configuration details can be found in the [main documentation](https://docs.luigi-project.io/docs/authorization-configuration#openid-connect-configuration). We support Authorization Code with PKCE and Implicit Grant flow.
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
@@ -61,15 +61,33 @@ Luigi.setConfig({
|
|
|
61
61
|
})
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
If you want to use the silent token renewal feature, the `silent-callback.html` needs to be copied to a folder in your Luigi Core installation,
|
|
65
|
-
which is the return path for the IdP provider, configured through the `redirect_uri` setting. The default location of `redirect_uri` is `/assets/auth-oidc/silent-callback.html`.
|
|
66
|
-
|
|
64
|
+
If you want to use the silent token renewal feature, the `silent-callback.html` needs to be copied to a folder in your Luigi Core installation,
|
|
65
|
+
which is the return path for the IdP provider, configured through the `redirect_uri` setting. The default location of `redirect_uri` is `/assets/auth-oidc/silent-callback.html`.
|
|
66
|
+
|
|
67
|
+
Next, you must install `oidc-client` in your project as a dev dependency:
|
|
67
68
|
|
|
68
69
|
```javascript
|
|
69
|
-
npm i -save-dev
|
|
70
|
+
npm i -save-dev oidc-client
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
Then, you need to
|
|
73
|
+
Then, you need to copy certain auxiliary plugin files and the callback file, as they are needed for the initial setup.
|
|
74
|
+
|
|
75
|
+
Respectively from `oidc-client` library you need:
|
|
76
|
+
- `oidc-client.min.js` which normally resides in `node_modules/oidc-client/dist`
|
|
77
|
+
|
|
78
|
+
and from our library `@luigi-project/plugin-auth-oidc` you need:
|
|
79
|
+
- `plugin.js`
|
|
80
|
+
- `silent-callback.html`
|
|
81
|
+
- `plugin-ie11.js` (for IE11 only)
|
|
82
|
+
which all reside under `node_modules/@luigi-project/plugin-auth-oidc/plugin.js`.
|
|
83
|
+
|
|
84
|
+
The above mentioned files should be copied to `assets/auth-oidc` as the default location.
|
|
85
|
+
|
|
86
|
+
Below we give some alternatives on how to easily copy these files in your project. However, you may choose your own way of copying these files depending on your environment.
|
|
87
|
+
|
|
88
|
+
For applications involving a webpack configuration, one way to copy files is using packages such as [copy-webpack-plugin](https://www.npmjs.com/package/copy-webpack-plugin) and then including the following in your webpack configuration file:
|
|
89
|
+
|
|
90
|
+
|
|
73
91
|
|
|
74
92
|
```javascript
|
|
75
93
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
@@ -97,3 +115,13 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
97
115
|
]
|
|
98
116
|
}
|
|
99
117
|
```
|
|
118
|
+
|
|
119
|
+
If your application does not use webpack or you installed Luigi without a framework, you can use an alternative way of copying the `silent-callback.html` file. You can use any copy plugin to copy the file and then modify the `package.json` script to copy the file when building. One package that could be helpful is [copyfiles](https://www.npmjs.com/package/copyfiles). Below is an example:
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
"buildConfig": "webpack --entry ./src/luigi-config/luigi-config.es6.js --output-path ./public/assets --output-filename luigi-config.js --mode production",
|
|
123
|
+
"build": "npm run buildConfig && npm run copyCallbackOIdc",
|
|
124
|
+
"copyCallbackOidc": "copyfiles -f node_modules/@luigi-project/plugin-auth-oidc/silent-callback.html node_modules/@luigi-project/plugin-auth-oidc/plugin.js node_modules/@luigi-project/plugin-auth-oidc/plugin-ie11.js node_modules/oidc-client/dist/oidc-client.min.js public/assets/auth-oidc"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Running `npm run build` should then suffice to bundle the config and also copy the callback file.
|
package/package.json
CHANGED