Skip to content

Commit

Permalink
Merge pull request #1583 from Infisical/daniel/saml-cli-fix
Browse files Browse the repository at this point in the history
Fix: SAML CLI login
  • Loading branch information
DanielHougaard authored Mar 18, 2024
2 parents cd192ee + 88e2eff commit 1d3e03e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/src/pages/login/select-organization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,25 @@ export default function LoginPage() {

const handleSelectOrganization = useCallback(
async (organization: Organization) => {
const callbackPort = queryParams.get("callback_port");

if (organization.authEnforced) {
// org has an org-level auth method enabled (e.g. SAML)
// -> logout + redirect to SAML SSO
let samlUrl = `/api/v1/sso/redirect/saml2/organizations/${organization.slug}`;

if (callbackPort) {
samlUrl += `?callback_port=${callbackPort}`;
}

await logout.mutateAsync();
window.open(`/api/v1/sso/redirect/saml2/organizations/${organization.slug}`);
window.open(samlUrl);
window.close();
return;
}

const { token } = await selectOrg.mutateAsync({ organizationId: organization.id });

const callbackPort = queryParams.get("callback_port");

if (callbackPort) {
const privateKey = localStorage.getItem("PRIVATE_KEY");

Expand Down

0 comments on commit 1d3e03e

Please sign in to comment.