1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-18 05:42:00 +03:00

Merge pull request #42 from stevenhammerton/sh-token-login

SH - CAS / Login token login
This commit is contained in:
Kegsay
2015-11-06 14:34:48 +00:00
2 changed files with 30 additions and 13 deletions

View File

@@ -1749,27 +1749,25 @@ MatrixClient.prototype.loginWithSAML2 = function(relayState, callback) {
};
/**
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
* @param {string} redirectUrl The URL to redirect to after the HS
* authenticates with CAS.
* @return {string} The HS URL to hit to begin the CAS login process.
*/
MatrixClient.prototype.getCasServer = function(callback) {
return this._http.request(
callback, "GET", "/login/cas", undefined, undefined
);
MatrixClient.prototype.getCasLoginUrl = function(redirectUrl) {
return this._http.getUrl("/login/cas/redirect", {
"redirectUrl": redirectUrl
}, httpApi.PREFIX_V1);
};
/**
* @param {string} ticket (Received from CAS)
* @param {string} service Service to which the token was granted
* @param {string} token Login token previously received from homeserver
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixClient.prototype.loginWithCas = function(ticket, service, callback) {
return this.login("m.login.cas", {
ticket: ticket,
service: service
MatrixClient.prototype.loginWithToken = function(token, callback) {
return this.login("m.login.token", {
token: token
}, callback);
};