Skip to content

Commit 7344830

Browse files
committed
Switch popup redirect from 302 to script.
The client needs to receive the URL fragment from OIDC, but Safari does not preserve it on 302 redirects: https://bugs.webkit.org/show_bug.cgi?id=158420
1 parent 4f3a008 commit 7344830

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/api/authn/webid-oidc.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,12 @@ function middleware (oidc) {
9090

9191
// Static assets related to authentication
9292
const authAssets = [
93+
['/.well-known/solid/login/', '../static/popup-redirect.html', false],
9394
['/common/', 'solid-auth-client/dist-popup/popup.html'],
9495
['/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js'],
9596
['/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js.map']
9697
]
97-
authAssets.map(([path, file]) => routeResolvedFile(router, path, file))
98-
// Redirect for .well-known login popup location
99-
router.get('/.well-known/solid/login',
100-
(req, res) => res.redirect('/common/popup.html'))
98+
authAssets.map(args => routeResolvedFile(router, ...args))
10199

102100
// Initialize the OIDC Identity Provider routes/api
103101
// router.get('/.well-known/openid-configuration', discover.bind(provider))

lib/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ function reqToPath (req) {
234234
/**
235235
* Adds a route that serves a static file from another Node module
236236
*/
237-
function routeResolvedFile (router, path, file) {
238-
const fullPath = path + file.match(/[^/]+$/)
237+
function routeResolvedFile (router, path, file, appendFileName = true) {
238+
const fullPath = appendFileName ? path + file.match(/[^/]+$/) : path
239239
const fullFile = require.resolve(file)
240240
router.get(fullPath, (req, res) => res.sendFile(fullFile))
241241
}

static/popup-redirect.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<script>location.replace(`/common/popup.html${location.hash}`)</script>

0 commit comments

Comments
 (0)