Skip to content

NekoWheel/passport-nekocas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

passport-nekocas

Passport strategy for authenticating with NekoCAS

Install

$ npm install passport-nekocas

Usage

Configure Strategy:

const NekocasStrategy = require('passport-nekocas').Strategy

passport.use(new NekocasStrategy({
  serviceBaseURL: 'http://localhost',
  secret: 'vNOZpKdqnUYcztBjUhvvPLpeYCIIBVev',
  domain: 'https://cas.n3ko.co'
}, function (user, done) {
  models.User.findOrCreate({
    where: {
      email: user.email
    }
  }).spread(function (user) {
    if (!user) return done(null, false)
    return done(null, user)
  }).catch(function (err) {
    return done(err)
  })
}))

Authenticate Requests:

passport.authenticate('nekocas', {
    successReturnToOrRedirect: '/',
    failureRedirect: '/',
    failureFlash: 'Failed to login.'
})(req, res, next)

About

Passport strategy for authenticating with NekoCAS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published