@muze-nl/metro-oidc 0.2.0 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/metro-oidc",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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.5.5",
52
- "@muze-nl/metro-oauth2": "^0.4.0"
51
+ "@muze-nl/metro": "^0.6.0",
52
+ "@muze-nl/metro-oauth2": "^0.5.0"
53
53
  }
54
54
  }
@@ -89,7 +89,7 @@ export default async function oidcDiscovery(options={}) {
89
89
  // note: this allows path components in the options.issuer url
90
90
  configURL
91
91
  )
92
- const openid_config = response.body[Symbol.metroSource]
92
+ const openid_config = response.data
93
93
  assert(openid_config, openid_provider_metadata)
94
94
 
95
95
  // https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation
@@ -63,7 +63,7 @@ export default async function register(options)
63
63
  .post(options.registration_endpoint, {
64
64
  body: options.client_info
65
65
  })
66
- let info = response.body
66
+ let info = response.data
67
67
  if (!info.client_id || !info.client_secret) {
68
68
  throw metro.metroError('metro.oidc: Error: dynamic registration of client failed, no client_id or client_secret returned', response)
69
69
  }
package/src/oidcmw.mjs CHANGED
@@ -99,6 +99,7 @@ export default function oidcmw(options={}) {
99
99
  const res = await next(req)
100
100
  const contentType = res.headers.get('content-type')
101
101
  if (contentType?.startsWith('application/json')) {
102
+ //FIXME; check that this is actually the token endpoint
102
103
  const res2 = res.clone() // otherwise res.body can't be read again
103
104
  try {
104
105
  let data = await res2.json()