Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout is only our session logout #343

Merged
merged 3 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
7 changes: 3 additions & 4 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
sfrunza13 marked this conversation as resolved.
Show resolved Hide resolved
if (user) {
const context = createLogoutRequest(user);
return redirect(context);
return await logout(request);
sfrunza13 marked this conversation as resolved.
Show resolved Hide resolved
}
return redirect('/');
};

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

This file was deleted.