0.1.0 • Published 7 years ago

flive-bp-adfs v0.1.0

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

add ADFS single sign-on to flive-boilerplate

Check adfs branch of the flive-boilerplate for integration details

Config example :

auth: {
    jwt: {
      options: {
        algorithm: 'HS256',
        issuer: 'flive-boilerplate',
        audience: 'flive-user',
        expiresIn: '7 days'
      },
      secret: 'very-long-secret-here'
    },
    adfs: {
      paths: {
        initiatePath: '/saml2',
        callbackPath: '/saml2',
        successRedirect: '/',
        failureRedirect: '/login'
      },
      validateProfile: (profile, app, done) => {
        // transform raw saml data to a user object
        // and fetch or insert user in DB if needed
        const user = { email: profile.nameID };
        done(null, user);
      },
      login: async (user, ctx) => {
        /* override passport login() if you want */
        //return ctx.login(user)
        /* setting the boilerplates JWT token here */
        return ctx.cookies.set('jwt', ctx.app.context.services.jwtSign({ user }));
      },
      samlConfig: {
        entryPoint: 'adfs',
        callbackUrl: 'https://saml.sp.sigfox.com/saml2',
        issuer: 'saml.sp.sigfox.com',
        cert: fs.readFileSync('/path/to/adfsCertificate')
      }
    }
  }