Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
TILA-2698 use passport state for csrf-check
Browse files Browse the repository at this point in the history
  • Loading branch information
kieferbonk committed Jun 27, 2023
1 parent 756f123 commit 0730b51
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('pages/user-reservations/UserReservationsPage', () => {
search: '',
},
history: {
push: () => {},
push: () => { },
},
t: path => path,
reduxReservations: {},
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('pages/user-reservations/UserReservationsPage', () => {
describe('tabs', () => {
const findTabs = wrapper => wrapper.find('[role="tab"]');
const findUpcomingTab = wrapper => findTabs(wrapper).at(0);
const findPastTab = wrapper => findTabs(wrapper).at(1);
// const findPastTab = wrapper => findTabs(wrapper).at(1);

test('should render upcoming and past tabs', () => {
expect(findTabs(getWrapper()).length).toEqual(2);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"bootstrap-sass": "3.4.1",
"camelcase-keys-deep": "^0.1.0",
"classnames": "2.2.5",
"csurf": "^1.11.0",
"dotenv": "7.0.0",
"dragscroll": "0.0.8",
"enzyme-to-json": "^3.3.5",
Expand Down
4 changes: 0 additions & 4 deletions server/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import cookieParser from 'cookie-parser';
import cookieSession from 'cookie-session';
import express from 'express';
import nocache from 'nocache';
import csurf from 'csurf';

import configurePassport from './configurePassport';
import getAuthState from './getAuthState';
Expand All @@ -25,8 +24,6 @@ router.use(cookieSession({
router.use(passport.initialize());
router.use(passport.session());

router.use(csurf({ cookie: true }));

router.get('/auth', nocache(), (req, res) => {
res.json(getAuthState(req));
});
Expand All @@ -39,7 +36,6 @@ router.get('/login',
passport.authenticate('helsinki'));

router.get('/login/helsinki/return',
csurf(),
passport.authenticate('helsinki', { failureRedirect: '/login' }),
(req, res) => {
if (req.session.next) {
Expand Down
1 change: 1 addition & 0 deletions server/auth/configurePassport.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function configurePassport() {
clientSecret: settings.CLIENT_SECRET,
callbackURL: settings.LOGIN_CALLBACK_URL,
proxy: Boolean(settings.PROXY),
state: true,
},
(accessToken, refreshToken, profile, cb) => {
helsinkiStrategy.getAPIToken(accessToken, settings.TARGET_APP, (token) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('ReservationInformationModal', () => {
});

describe('refund policy', () => {
// eslint-disable-next-line max-len
test('rendered when resource is not null, when user is admin, when reservation is not a staff event and when the reservation has a price', () => {
const getRefundPolicy = (wrapper) => {
return wrapper.find({ id: 'refund-policy' });
Expand Down

0 comments on commit 0730b51

Please sign in to comment.