From c22382360b9ad6a1bd2db423f78945ba592f30a3 Mon Sep 17 00:00:00 2001 From: Steven Hammerton Date: Thu, 8 Oct 2015 22:22:29 +0100 Subject: [PATCH] Add client functions around new synapse CAS login --- lib/client.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/client.js b/lib/client.js index 5726fa489..310da7815 100644 --- a/lib/client.js +++ b/lib/client.js @@ -1728,6 +1728,31 @@ MatrixClient.prototype.loginWithSAML2 = function(relayState, callback) { }, callback); }; +/** + * @param {module:client.callback} callback Optional. + * @return {module:client.Promise} Resolves: TODO + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixClient.prototype.getCasServer = function(callback) { + return this._http.authedRequest( + callback, "GET", "/login/cas", undefined, undefined + ); +}; + +/** + * @param {string} ticket (Received from CAS) + * @param {string} service Service to which the token was granted + * @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 + }, callback); +}; + // Push operations // ===============