The current CAS sso-login consists in clicking a "CAS" button on the login page.
This behaviour shall not be changed, but an additional route under the CAS Plugin path could easily auto-login the user by initiating a redirect, instead of waiting for the user to click a button on the login page.
+1, this feature is required.. has anyone succeeded with this type redirect..?
+1, highly needed!
Any news on this issue ? (Wich is a duplicate of https://github.com/RocketChat/Rocket.Chat/issues/3052 )
So this snippet will try to use a hidden iframe to autologin - it only works if the user is already logged into the CAS - if not, the regular login path is still avaliable. This should go under custom scripts for logged out users.
(function() {
const credentialToken = Random.id();
const login_url = RocketChat.settings.get('CAS_login_url');
if (!login_url) return;
const appUrl = Meteor.absoluteUrl().replace(/\/$/, '') + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
const delim = (login_url.split('?').length > 1) ? '&' : '?';
var i = document.createElement('iframe');
i.style.display = 'none';
i.onload = function() {
Accounts.callLoginMethod({
methodArguments: [{ cas: { credentialToken } }],
});
};
i.src = `${ login_url }${ delim }service=${ appUrl }/_cas/${ credentialToken }`;
document.body.appendChild(i);
})();
This feature is highly needed!
I backed this issue on Bountysource: https://www.bountysource.com/issues/31231979-cas-plugin-add-direct-login-redirect-for-a-cas-enabled-rc-instance
+1
Feature highly needed as well.
Many user don't even know what they have to do.
They don't read tips dislayed, nor reads documentation.
in custom script we can add a such js:
window.onload = (event) => {
setTimeout(function() {
document.querySelector('#login-card .external-login.cas span').click();
}, 500);
};
But some browsers (like Firefox) are blocking window opened directly.
So having a specific Route for direct CAS login will be great ! I can help if you tell me where we can configure a new route.
+1 We really need this.
@MarZab
Marko thanks for this code. We changed it a bit to have it working every time.
In "Custom Script for Logged Out Users" we set:
const credentialToken = Random.id();
const login_url = "https://cas.domain.com/login";
const appUrl = Meteor.absoluteUrl().replace(/\/$/, '') + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
const delim = (login_url.split('?').length > 1) ? '&' : '?';
var i = document.createElement('iframe');
i.style.display = 'none';
i.onload = function() {
Accounts.callLoginMethod({
methodArguments: [{ cas: { credentialToken } }],
});
};
i.src = `${ login_url }${ delim }service=${ appUrl }/_cas/${ credentialToken }`;
document.body.appendChild(i);
In "Custom Script for Logout Flow" we set:
const logout_url = "https://cas.domain.com/logout";
var i = document.createElement('iframe');
i.style.display = 'none';
i.src = `${ logout_url }`;
document.body.appendChild(i);
And it works great now. :-)
Most helpful comment
Any news on this issue ? (Wich is a duplicate of https://github.com/RocketChat/Rocket.Chat/issues/3052 )