Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/views/AuthenticationWebView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ const AuthenticationWebView = () => {
}
if (authType === 'saml' || authType === 'cas') {
const parsedUrl = parse(url, true);
// ticket -> cas / validate & saml_idp_credentialToken -> saml
if (parsedUrl.pathname?.includes('validate') || parsedUrl.query?.ticket || parsedUrl.query?.saml_idp_credentialToken) {
let payload: ICredentials;
if (authType === 'saml') {
// Only close the webview when redirected back to the Rocket.Chat server
// This prevents premature closure when CAS delegates to another CAS server for MFA
const isRocketChatServer = url.includes(server);
// ticket -> cas / validate & saml_idp_credentialToken -> saml
if (isRocketChatServer && (parsedUrl.pathname?.includes('validate') || parsedUrl.query?.ticket || parsedUrl.query?.saml_idp_credentialToken)) {
const token = parsedUrl.query?.saml_idp_credentialToken || ssoToken;
const credentialToken = { credentialToken: token };
payload = { ...credentialToken, saml: true };
Expand Down