@muze-nl/metro-oidc 0.3.3 → 0.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/metro-oidc",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "oidc client middleware for @muze-nl/metro",
5
5
  "type": "module",
6
6
  "source": [
@@ -48,7 +48,7 @@
48
48
  ],
49
49
  "dependencies": {
50
50
  "@muze-nl/assert": "^0.3.3",
51
- "@muze-nl/metro": "^0.6.1",
52
- "@muze-nl/metro-oauth2": "^0.5.2"
51
+ "@muze-nl/metro": "^0.6.5",
52
+ "@muze-nl/metro-oauth2": "^0.5.5"
53
53
  }
54
54
  }
package/src/oidcmw.mjs CHANGED
@@ -76,6 +76,7 @@ export default function oidcmw(options={}) {
76
76
  // now initialize an oauth2 client stack, using options.client as default
77
77
  // with forceAuthentication: true
78
78
  const scope = options.scope || 'openid'
79
+
79
80
  const oauth2Options = Object.assign(
80
81
  {
81
82
  site: options.issuer,
@@ -91,7 +92,7 @@ export default function oidcmw(options={}) {
91
92
  authorization_endpoint: options.openid_configuration.authorization_endpoint,
92
93
  token_endpoint: options.openid_configuration.token_endpoint,
93
94
  scope, //FIXME: should only use scopes supported by server
94
- redirect_uri: options.client_info.redirect_uris[0] //FIXME: find the best match?
95
+ redirect_uri: options.client_info.redirect_uris[0]
95
96
  }
96
97
  }
97
98
  //...
@@ -148,5 +149,11 @@ export function isRedirected() {
148
149
  }
149
150
 
150
151
  export function idToken(options) {
152
+ if (!options.store) {
153
+ if (!options.issuer) {
154
+ throw metro.metroError('Must supply options.issuer or options.store to get the id_token')
155
+ }
156
+ options.store = oidcStore(options.issuer)
157
+ }
151
158
  return options.store.get('id_token')
152
159
  }