Skip to content

Commit

Permalink
Logout is only our session logout (#343)
Browse files Browse the repository at this point in the history
* Logout is only our session logout

* Adding more helpful comment

* redundant await logout.tsx ln11

---------

Co-authored-by: stefanaz2 <sfrunza@seneca.ca>
  • Loading branch information
sfrunza13 and stefanaz2 committed Mar 15, 2023
1 parent 5445a01 commit f4a9b89
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
5 changes: 0 additions & 5 deletions app/lib/saml.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ export function createLoginRequest(redirectUrl: string = '/') {
return url.href;
}

export function createLogoutRequest(user: string) {
const { context } = sp.createLogoutRequest(idp, 'redirect', { nameID: user });
return context;
}

export async function parseLoginResponse(body: { [k: string]: FormDataEntryValue }) {
const { extract } = await sp.parseLoginResponse(idp, 'post', {
body,
Expand Down
9 changes: 4 additions & 5 deletions app/routes/logout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { redirect } from '@remix-run/node';
import { getUsername } from '~/session.server';
import { getUsername, logout } from '~/session.server';

import type { ActionArgs } from '@remix-run/node';
import { createLogoutRequest } from '~/lib/saml.server';

export const action = async ({ request }: ActionArgs) => {
const user = await getUsername(request);

// Do the opposite of login
// Invalidate the Starchart session but do not log out from Seneca IDP.
if (user) {
const context = createLogoutRequest(user);
return redirect(context);
return logout(request);
}
return redirect('/');
};

export const loader = async () => {
Expand Down
15 changes: 0 additions & 15 deletions app/routes/logout/callback.tsx

This file was deleted.

0 comments on commit f4a9b89

Please sign in to comment.