Installation

Download the system, cd into the app directory, then execute:

meteor npm install
meteor npm run start

The settings file is needed to provide CAS parameter information. Note that you won’t be able to successfully login until you edit the settings.development.json file to indicate that your UH account should be one of those allowed to login.

Note regarding bcrypt warning. You will get the following message when you run this application:

Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run

  meteor npm install --save bcrypt

in the root directory of your application.

On some operating systems (particularly Windows), installing bcrypt is much more difficult than implied by the above message. Bcrypt is only used in Meteor for password checking, so the performance implications are negligible until your site has very high traffic. You can safely ignore this warning without any problems.

Packages

Note that this system adds two packages to support UH CAS authentication:

  1. atoy40:accounts-cas.
  2. ‘random’ (from the meteor core)

Walkthrough

Meteor-example-uh-cas is a fork of meteor-application-template that illustrates how to perform University of Hawaii CAS authentication.

It defines a template called Cas_Login in cas-login.html and cas-login.js.
The Cas_Login template is invoked in header.html to put the menu item in the navbar for logging in and out.

The settings.development.json file provides the configuration parameters to the meteor-accounts-cas package. Note that only two users are allowed to sign in; you will want to edit this setting before adapting this code to your own application.

Checking to see that only the users specified in the settings.development.json file are allowed is implemented in accounts.js. This file defines a function for validating new users that checks the user-supplied account name against the list of authorized account names in the settings file.

After successful authentication, the home page shows the name of the logged in user and the menu changes to provide a logout link:

Note that UH CAS authentication saves a cookie that persists after logout. This means that after you logout, if you click the login button again, you will be immediately logged in without needing to re-enter your credentials. This, I guess, is a feature, not a bug.

About the UH CAS test server

The settings file configures your application to use the University of Hawaii “test” CAS server. This server is different from the production UH CAS server in one significant way: not all UH accounts are available on this server. If you wish to use this server, you must first communicate with the UH ITS staff to ensure that it is configured with your UH account information.

For an overview of CAS in general and its implementation at UH, see the Introduction to CAS Screencast.

Documentation on UH CAS is found here.

Credits

Thanks to Yongwen Xu for the sample code.