insomnia/packages/insomnia-smoke-test/server/basic-auth.ts
David Marby 5af79c7486
Create smoketests for oauth flows (#4511)
* Move basic auth routes to a separate file

* Stop slowing requests down artificially

* Add initial oauth routes

* Mount oidc routes under /oidc

* Enable all forms of oauth that Insomnia supports

* Add oauth request collection fixture

* Update playwright config

* Use 127.0.0.1 instead of localhost

* simple oauth2 test

* Make the playwright extension work

* Move oauth tests to a separate file

* Test all oauth flows

* Mark test as slow

* Wait for load state for new pages

* Use locators consistently

* Add playwright to recommended extensions

* Add instructions for how to use the playwright extension

* update selectors and use fill

* Fix markdown lint

Co-authored-by: jackkav <jackkav@gmail.com>
Co-authored-by: gatzjames <jamesgatzos@gmail.com>
2022-02-28 16:28:02 +01:00

23 lines
519 B
TypeScript

import express from 'express';
import basicAuth from 'express-basic-auth';
import { basicAuthCreds } from '../fixtures/constants';
const { utf8, latin1 } = basicAuthCreds;
const users = {
[utf8.encoded.user]: utf8.encoded.pass,
[latin1.encoded.user]: latin1.encoded.pass,
};
export const basicAuthRouter = express.Router();
basicAuthRouter.use(basicAuth({ users }));
basicAuthRouter.get('/', (_, res) => {
res
.status(200)
.header('content-type', 'text/plain')
.send('basic auth received');
});