Skip to content

Commit

Permalink
Merge pull request #783 from matrix-org/rav/sso_login_type
Browse files Browse the repository at this point in the history
Add 'getSsoLoginUrl' function
  • Loading branch information
richvdh authored Nov 19, 2018
2 parents ac79d6b + 5b51096 commit 17c11ae
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/base-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,23 @@ MatrixBaseApis.prototype.loginWithSAML2 = function(relayState, callback) {
* @return {string} The HS URL to hit to begin the CAS login process.
*/
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 = "sso";
}
return this._http.getUrl("/login/"+loginType+"/redirect", {
"redirectUrl": redirectUrl,
}, httpApi.PREFIX_UNSTABLE);
}, httpApi.PREFIX_R0);
};

/**
Expand Down

0 comments on commit 17c11ae

Please sign in to comment.