All Projects → italia → spid-passport

italia / spid-passport

Licence: BSD-3-Clause License
Passport authentication provider for SPID

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to spid-passport

yelp-camp
A Node.js web application project from the Udemy course - The Web Developer Bootcamp by Colt Steele
Stars: ✭ 36 (+111.76%)
Mutual labels:  passport
QKMRZScanner
Scan MRZ (Machine Readable Zone) from identity documents (passport, id, visa) using iPhone/iPad (iOS)
Stars: ✭ 81 (+376.47%)
Mutual labels:  passport
chat-app
An Express React Redux Socket.IO Chat App that uses MongoDB with Mongoose driver as database and Passport for user authentication.
Stars: ✭ 24 (+41.18%)
Mutual labels:  passport
spid-smart-button
Nuovo pulsante login per SPID basato su finestra modale JavaScript (in sviluppo)
Stars: ✭ 15 (-11.76%)
Mutual labels:  spid
spid-sp-test
SAML2 SPID/CIE Service Provider validation tool
Stars: ✭ 27 (+58.82%)
Mutual labels:  spid
node-express-mongo-passport-jwt-typescript
A Node.js back end web application with REST API, user JWT authentication and MongoDB data storage using TypeScript
Stars: ✭ 51 (+200%)
Mutual labels:  passport
jeesuite-passport
Jeesuite-passport是面向企业级单点登录、统一认证的一站式解决方案。支持微信、企业微信、主流开放平台OAuth、Oauth2.0,JWT、SAML2.0多种认证集成模式。
Stars: ✭ 108 (+535.29%)
Mutual labels:  passport
node-facebook-twitter-google-github-login
Node, Express, Mongoose, Passport, Facebook, Twitter, Google and Github Authentication (Login)
Stars: ✭ 31 (+82.35%)
Mutual labels:  passport
spid-express
Express middleware implementing SPID & Entra con CIE (Carta d'Identità Elettronica)
Stars: ✭ 27 (+58.82%)
Mutual labels:  spid
chai-passport-strategy
Helpers for testing Passport strategies with the Chai assertion library.
Stars: ✭ 32 (+88.24%)
Mutual labels:  passport
system information school
Build website using laravel as backend, vue js as front end and full request using api with middleware api passport.
Stars: ✭ 17 (+0%)
Mutual labels:  passport
Clean-Laravel-Api
⭐️ Build APIs You Won't Hate In Laravel.
Stars: ✭ 85 (+400%)
Mutual labels:  passport
TogetherStream
A social and synchronized streaming experience
Stars: ✭ 16 (-5.88%)
Mutual labels:  passport
teanjs
🔥 TypeORM - Express - Angular 8 - NestJS Server Side Rendering (SSR) 😺
Stars: ✭ 62 (+264.71%)
Mutual labels:  passport
nestjs-auth0
An example NestJS application that uses Auth0 via Passport for authentication.
Stars: ✭ 148 (+770.59%)
Mutual labels:  passport
Laravel-Ecommerce-API
Lite E-Commerce API
Stars: ✭ 32 (+88.24%)
Mutual labels:  passport
laravel8-passport-fcm-api
Live streaming gigs mobile app RESTful API endpoints
Stars: ✭ 13 (-23.53%)
Mutual labels:  passport
http-auth
Node.js package for HTTP basic and digest access authentication.
Stars: ✭ 364 (+2041.18%)
Mutual labels:  passport
spid-compliant-certificates
Solution to create self-signed certificates according to Avviso SPID n.29
Stars: ✭ 19 (+11.76%)
Mutual labels:  spid
react-isomorphic-bundle
React Redux Universal (isomorphic) bundle
Stars: ✭ 53 (+211.76%)
Mutual labels:  passport

⚠️ Questo repository non è più mantenuto, si consiglia di usare spid-express ⚠️

spid-passport

Provider di autenticazione Passport per SPID

Questo modulo consente di autenticare gli utenti tramite SPID (Servizio Publico di Identità Digitale) nelle applicazioni Nodejs che fanno uso di Passport.

Installazione

$ npm install spid-passport

Utilizzo

Configurazione

Sono necessari i parametri di configurazione del Service Provider e dei diversi Identity Provider; nello specifico il costruttore prende in input due oggetti e una callback di verifica. Le opzioni possibili sono tutte quelle messe a disposizione dalla libreria passport-saml, con l'unica differenza che i parametri relativi agli Identity Provider sono ripetuti per ciascun Identity Provider supportato da SPID. I parametri obbligatori sono:

Service Provider:
  • (String) issuer - Id dell'entita che fornisce il servizio, può essere qualsiasi cosa, tipicamente è la URL del Service Provider
  • (String) privateCert - Chiave privata del Service Provider (Formato PEM)
  • (String) path - Endpoint sul quale ricevere la response dall'identity provider; viene combinata con le informazioni dell'host per costruire una url completa
  • (Number) attributeConsumingServiceIndex - Indice posizionale sul metadata che identifica il set di attributi richiesti all'Identity Provider
  • (String) identifierFormat - Formato dell'identificativo dell'utente, per SPID va valorizzato a urn:oasis:names:tc:SAML:2.0:nameid-format:transient
  • (String) authnContext - Livello SPID richiesto (a scelta tra: https://www.spid.gov.it/SpidL1, https://www.spid.gov.it/SpidL2, https://www.spid.gov.it/SpidL3)
Identity Provider
  • (String) entryPoint - Endpoint per effettuare il login, verrà effettuato un redirect verso questa URL
  • (String) cert - Certificato dell'Identity Provider (Formato PEM)

Esempio di utilizzo con express e spid-test-env

const fs = require('fs')
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const passport = require('passport')
const SpidStrategy = require('passport-spid')


app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

// init passport
app.use(passport.initialize())

let spidStrategy = new SpidStrategy({
  sp: {
    callbackUrl: "https://example.com/acs",
    issuer: "https://example.com",
    privateCert: fs.readFileSync("./certs/key.pem", "utf-8"),
    decryptionPvk: fs.readFileSync("./certs/key.pem", "utf-8"),
    attributeConsumingServiceIndex: 1,
    identifierFormat: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
    authnContext: "https://www.spid.gov.it/SpidL1"
    attributes: {
      name: "Required attributes",
      attributes: ["fiscalNumber", "name", "familyName", "email"]
    },
    organization: {
      name: "Organization name",
      displayName: "Organization display name",
      URL: "https://example.com"
    }
  },
  idp: {
    test: {
      entryPoint: "https://spid-testenv-identityserver:9443/samlsso",
      cert: "MIICNTCCAZ6gAwIBAgIES343gjANBgkqhkiG9w0BAQUFADBVMQswCQYD..."
    },
    idp2: {
      entryPoint: "https://...",
      cert: "..."
    }
  }
}, function(profile, done){

  // Find or create user
  console.log(profile)
  done(null, profile);
})

passport.use(spidStrategy)

app.get("/login", passport.authenticate('spid'))

app.post("/acs",
  passport.authenticate('spid', {session: false}),
  function(req, res){
    console.log(req.user)
    res.send(`Hello ${req.user.name_id}`)
  })

// Create xml metadata
app.get("/metadata", spidStrategy.generateServiceProviderMetadata())


app.listen(3000);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].