@kenote/koa-passport
v1.0.32
Published
Passport plug-in based on Koa for Kenote.js.
Downloads
87
Readme
@kenote/koa-passport
Passport plug-in based on Koa for Kenote.js.
Usage
index.ts
import { Module, ServerFactory } from '@kenote/core'
import { ServiceEngine } from '@kenote/koa'
import session from '@kenote/koa-session'
import redisStore from 'koa-redis'
import passportPlugin from '@kenote/koa-passport'
import passport from 'koa-passport'
import { Strategy } from 'passport-local'
// Add Strategy
passport.use(new Strategy(
(username, password, done) => {
return done(null, { username })
}
))
@Module({
imports: [],
plugins: [
session({
store: redisStore(),
}),
passportPlugin()
],
})
class AppModule {}
async bootstarp () {
let factory = await ServerFactory(new ServiceEngine()).create(AppModule)
factory.server.listen(4000)
}
MIT License.