Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 60x 147x 147x 147x 5x 2x 1x 1x 1x 4x 4x 4x 60x 60x | import { Response } from 'express';
import { IUnleashConfig } from '../types/option';
import Controller from './controller';
import { IAuthRequest } from './unleash-types';
class LogoutController extends Controller {
private baseUri: string;
constructor(config: IUnleashConfig) {
super(config);
this.baseUri = config.server.baseUriPath;
this.get('/', this.logout);
}
async logout(req: IAuthRequest, res: Response): Promise<void> {
if (req.session) {
// Allow SSO to register custom logout logic.
if (req.session.logoutUrl) {
res.redirect(req.session.logoutUrl);
return;
}
req.session.destroy();
}
Iif (req.logout) {
req.logout();
}
res.set('Clear-Site-Data', '"cookies", "storage"');
res.redirect(`${this.baseUri}/`);
}
}
module.exports = LogoutController;
export default LogoutController;
|