Skip to content

Commit 536537d

Browse files
committed
fix unable to login if authentication is delegated to another CAS server issue
1 parent 0d13c14 commit 536537d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/views/AuthenticationWebView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ const AuthenticationWebView = () => {
105105
}
106106
if (authType === 'saml' || authType === 'cas') {
107107
const parsedUrl = parse(url, true);
108-
// ticket -> cas / validate & saml_idp_credentialToken -> saml
109-
if (parsedUrl.pathname?.includes('validate') || parsedUrl.query?.ticket || parsedUrl.query?.saml_idp_credentialToken) {
110-
let payload: ICredentials;
111-
if (authType === 'saml') {
108+
// Only close the webview when redirected back to the Rocket.Chat server
109+
// This prevents premature closure when CAS delegates to another CAS server for MFA
110+
const isRocketChatServer = url.includes(server);
111+
// ticket -> cas / validate & saml_idp_credentialToken -> saml
112+
if (isRocketChatServer && (parsedUrl.pathname?.includes('validate') || parsedUrl.query?.ticket || parsedUrl.query?.saml_idp_credentialToken)) {
112113
const token = parsedUrl.query?.saml_idp_credentialToken || ssoToken;
113114
const credentialToken = { credentialToken: token };
114115
payload = { ...credentialToken, saml: true };

0 commit comments

Comments
 (0)