1.3.2 • Published 6 years ago

egg-bs-sso v1.3.2

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

egg-bs-sso

白山node应用的sso插件。

Install

$ npm i egg-bs-sso --save

Usage

// {app_root}/config/plugin.js
exports.bsSso = {
	enable: true,
	package: 'egg-bs-sso'
}

Configuration

// {app_root}/config/config.default.js
exports.bsSso = {
	// sso信息配置
	constant: {
		UC_ID: 0,
		UC_SERVICE: '',
		UC_SECRET: '',
		UC_SALT: ''
	},
	// 登录成功后返回用户信息的处理
	userFunction: async (ctx, user) => {
		const { User, Platform } = ctx.model
		const userResult = await User.findOne({ uid: user.uid })
		if (!userResult) {
			const platforms = await Platform.find().select('_id').exec()
			const _user = new User({
				platforms: platforms,
				...user
			})
			return await _user.save()
		} else {
			return userResult
		}
	},
	// token有效小时
	tokenTime: 24,
	// 忽略的url前缀
	ignoreUrlPrefix: /\/api/
}

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago