1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Add 'getSsoLoginUrl' function

This commit is contained in:
Richard van der Hoff
2018-11-15 19:00:37 +00:00
parent b233ab87bb
commit 578cb4e268

View File

@@ -310,9 +310,23 @@ MatrixBaseApis.prototype.loginWithSAML2 = function(relayState, callback) {
* @return {string} The HS URL to hit to begin the CAS login process. * @return {string} The HS URL to hit to begin the CAS login process.
*/ */
MatrixBaseApis.prototype.getCasLoginUrl = function(redirectUrl) { MatrixBaseApis.prototype.getCasLoginUrl = function(redirectUrl) {
return this._http.getUrl("/login/cas/redirect", { return this.getSsoLoginUrl(redirectUrl, "cas");
};
/**
* @param {string} redirectUrl The URL to redirect to after the HS
* authenticates with the SSO.
* @param {string} loginType The type of SSO login we are doing (sso or cas).
* Defaults to 'sso'.
* @return {string} The HS URL to hit to begin the SSO login process.
*/
MatrixBaseApis.prototype.getSsoLoginUrl = function(redirectUrl, loginType) {
if (loginType === undefined) {
loginType = "cas";
}
return this._http.getUrl("/login/"+loginType+"/redirect", {
"redirectUrl": redirectUrl, "redirectUrl": redirectUrl,
}, httpApi.PREFIX_UNSTABLE); }, httpApi.PREFIX_R0);
}; };
/** /**