Rocket.chat: CAS Plugin: Upgrade cas libs to support CAS 2.0 protocol

Created on 24 Feb 2016  路  14Comments  路  Source: RocketChat/Rocket.Chat

The current CAS plugin supports only CAS 1.0 which is sufficient to login with a username.

The CAS 2.0 protocol transports user attributes such as Common Name, Email, and even custom attributes. The minimal implementation for CAS 2.0 rocketchat plugin would allow defining a map of attributes, which are parsed from the CAS response and will be mapped towards what RC user attributes:

  • cas_response.email -> rc.user.emails
  • cas_response.fullname -> rc.user.name/profile
Auth - CAS

Most helpful comment

I'm on a good track now - got early CAS 2.0 response working, but it broke 1.0 ... priceless. I'm on it.

All 14 comments

One possible candidate which provides CAS 2.0: https://github.com/joshchan/node-cas

Another probably better candidate would be https://www.npmjs.com/package/xcas

Tried to use official npmjs modules to provide a CAS 2.0 library - but I failed to find a sane packaged version. Instead I tried to pull in some github module by adding it as local files, but it seems that Meteor doesnt support this practice, yet. I'm not aware of a workaround.

A heads up from @Sing-Li was given to wait till RC switched to Meteor 1.3:
https://github.com/meteor/meteor/blob/release-1.3/packages/module /README.md

Upgraded my test instance to latest develop state and tried using meteor 1.4 features such as Meteor | Npm.depends and npmjs package definitions

Versions:
rocketchat_1 | npm info using [email protected]
rocketchat_1 | npm info using [email protected]
[email protected]

Tried using the new package imports as described above:
Npm.depends({
cas: 'https://github.com/joshchan/node-cas/tarball/master'
});

This fails with:
rocketchat_1 | While reading package from '/app/packages/rocketchat-cas':
rocketchat_1 | package.js:29:5: must declare valid version of dependency:
rocketchat_1 | cas@https://github.com/joshchan/node-cas/tarball/master

@Sing-Li Any idea why this fails?

@corecache Meteor 1.4 supports npm modules directly now. Please see https://guide.meteor.com/using-npm-packages.html

Basically, you can just meteor npm install --save <npm package name>

@RocketChat/core Are we starting to create new package as npm packages now? Are we migrating?

@rodrigok can you help @corecache here?

I'll take a look after the 0.40 release

@corecache please try using this syntax:

Npm.depends({
    cas: 'git+https://github.com/joshchan/node-cas#master'
});

That seems to work.
According to npmjs - pacjage.json the "Local paths" should work aswell, but when adding something like
cas: "file:test/foobar" or simply cas: "foobar/test" I do get "must declare valid version of dependency" errors

Edit: I want to edit/develop locally before always pushing/fetching from a github repo for local testing

Edit2: Using npm install --save cas@git+https://github.com/joshchan/node-cas#master adds the module to /app/node_modules and adding the absolute path cas: "file:///app/node_modules/cas"' to the package.json seems to load the module correctly at least - but modifying the /app/node_modules/cas module doesnt reload the dev server on modifications. It seems I'm forced to restart and initiate a reload myself.

@corecache do you need our help?

I'm on a good track now - got early CAS 2.0 response working, but it broke 1.0 ... priceless. I'm on it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mddvul22 picture mddvul22  路  3Comments

ghost picture ghost  路  3Comments

karlprieb picture karlprieb  路  3Comments

engelgabriel picture engelgabriel  路  3Comments

antn89 picture antn89  路  3Comments