@muze-nl/metro-oidc 0.5.1 → 0.5.2
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/dist/browser.js +13 -5
- package/dist/browser.js.map +2 -2
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +2 -2
- package/package.json +1 -1
- package/src/oidc.register.mjs +10 -3
- package/src/oidcmw.mjs +3 -4
package/package.json
CHANGED
package/src/oidc.register.mjs
CHANGED
|
@@ -53,12 +53,19 @@ export default async function register(options)
|
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
const defaultOptions = {
|
|
56
|
-
client: metro.client().with(throwermw()).with(jsonmw())
|
|
56
|
+
client: metro.client().with(throwermw()).with(jsonmw()),
|
|
57
|
+
client_info: {
|
|
58
|
+
redirect_uris: [ globalThis.document?.location.href ]
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
options = Object.assign({}, defaultOptions, options)
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
if (!options.client_info) {
|
|
64
|
+
options.client_info = {}
|
|
65
|
+
}
|
|
66
|
+
if (!options.client_info.redirect_uris) {
|
|
67
|
+
options.client_info.redirect_uris = [ globalThis.document?.location.href ]
|
|
68
|
+
}
|
|
62
69
|
let response = await options.client
|
|
63
70
|
.post(options.registration_endpoint, {
|
|
64
71
|
body: options.client_info
|
package/src/oidcmw.mjs
CHANGED
|
@@ -36,7 +36,7 @@ export default function oidcmw(options={}) {
|
|
|
36
36
|
if (!options.openid_configuration && options.store.has('openid_configuration')) {
|
|
37
37
|
options.openid_configuration = options.store.get('openid_configuration')
|
|
38
38
|
}
|
|
39
|
-
if (!options.client_info
|
|
39
|
+
if (!options.client_info?.client_id && options.store.has('client_info')) {
|
|
40
40
|
options.client_info = options.store.get('client_info')
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -62,7 +62,6 @@ export default function oidcmw(options={}) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
if (!options.client_info?.client_id) {
|
|
65
|
-
assert(options.client_info?.client_name, Required())
|
|
66
65
|
if (!options.openid_configuration.registration_endpoint) {
|
|
67
66
|
throw metro.metroError('metro.oidcmw: Error: issuer '+options.issuer+' does not support dynamic client registration, but you haven\'t specified a client_id')
|
|
68
67
|
}
|
|
@@ -84,8 +83,8 @@ export default function oidcmw(options={}) {
|
|
|
84
83
|
force_authorization: true,
|
|
85
84
|
authorize_callback: options.authorize_callback,
|
|
86
85
|
oauth2_configuration: {
|
|
87
|
-
client_id: options.client_info
|
|
88
|
-
client_secret: options.client_info
|
|
86
|
+
client_id: options.client_info?.client_id,
|
|
87
|
+
client_secret: options.client_info?.client_secret,
|
|
89
88
|
grant_type: 'authorization_code',
|
|
90
89
|
response_type: 'code',
|
|
91
90
|
response_mode: 'query',
|