forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added router to rediect github auth (rancher#9262)
* Added router to rediect github auth * Added env variables for client id * Fixed broken server Middleware * Removed e2e changes * Fixed lint * Removed code for test * Clean code
- Loading branch information
1 parent
e183948
commit 141d277
Showing
3 changed files
with
8 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
import { URL } from 'url'; | ||
|
||
export default function(req, res, next) { | ||
const parsed = new URL(req.url, 'https://localhost'); | ||
|
||
if ( parsed.searchParams.has('spa') ) { | ||
res.spa = true; | ||
console.log('SPA mode enabled'); // eslint-disable-line no-console | ||
} | ||
|
||
module.exports = function(req, res, next) { | ||
// We do this redirect so that /verify-auth can work with both standalone and | ||
// while dashboard is nested under ember. | ||
if (req.url.includes('/verify-auth') || req.url.includes('/verify-auth-azure')) { | ||
res.writeHead(301, { Location: req.url.replace(/verify-auth(-azure)?/, 'auth/verify') }); | ||
res.end(); | ||
} | ||
|
||
return; | ||
} | ||
next(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters