1.0.0 • Published 6 years ago
egg-cas-plugin v1.0.0
egg-cas-plugin
Install
$ npm i egg-cas-plugin --save
Usage
// {app_root}/config/plugin.js
exports.casPlugin = {
enable: true,
package: 'egg-cas-plugin',
}
Configuration
// {app_root}/config/config.default.js
exports.casPlugin = {
serviceUrl: 'your own service url',
casBaseUrl: 'base url is not necessary, default is https://cas.mioffice.cn, you can rewrite it here if necessary',
}
// This plugin is using a middleware called casmiddleware, you can also set your match path of this middleware like below.
exports.casmiddleware = {
match: ctx => {
if (ctx.path === '/api/logout') {
return false
}
const needAuth = ctx.path.startsWith('/api')
return needAuth
},
}
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.
License
1.0.0
6 years ago