1.0.2 • Published 6 years ago

koa2-cas-authentication v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Installation

npm install koa-authentication

Usage

This library is based on cas-authentication, and the interface is the same. You can refer to that documwnt.

usage

// variable declaration
const CasAuthentication = require('koa2-cas-authentication');

const casConfig = require('../config/cas');

const cas = new CasAuthentication(Object.assign(casConfig, {
    session_info: 'user',
    session_name: 'username'
}));

...
// controller code
const isLogin = await cas.bounce(ctx);

if (isLogin) {
    await ctx.render('index');
}