Update CAS login to allow HS to do interaction with CAS and client receives and redeems login token

This commit is contained in:
Steven Hammerton
2015-11-06 11:21:13 +00:00
parent 3fec3a7326
commit de165ea6ad
3 changed files with 15 additions and 46 deletions

View File

@@ -23,8 +23,6 @@ var sdk = require('../../index');
var MatrixTools = require('../../MatrixTools');
var linkifyMatrix = require("../../linkify-matrix");
var Cas = require("../../CasLogic");
module.exports = {
PageTypes: {
RoomView: "room_view",
@@ -140,14 +138,17 @@ module.exports = {
});
this.notifyNewScreen('login');
break;
case 'cas_login':
case 'token_login':
if (this.state.logged_in) return;
var self = this;
var client = MatrixClientPeg.get();
var serviceUrl = Cas.getServiceUrl();
MatrixClientPeg.replaceUsingUrls(
payload.params.homeserver,
payload.params.identityServer
);
client.loginWithCas(payload.params.ticket, serviceUrl).done(function(data) {
var client = MatrixClientPeg.get();
client.loginWithToken(payload.params.loginToken).done(function(data) {
MatrixClientPeg.replaceUsingAccessToken(
client.getHomeserverUrl(), client.getIdentityServerUrl(),
data.user_id, data.access_token
@@ -387,9 +388,9 @@ module.exports = {
action: 'start_login',
params: params
});
} else if (screen == 'cas_login') {
} else if (screen == 'token_login') {
dis.dispatch({
action: 'cas_login',
action: 'token_login',
params: params
});
} else if (screen.indexOf('room/') == 0) {