metadata-saml2

2.0.1 • Public • Published

metadata-saml2

Parse SAML metadata.xml files with minimal dependencies

Installation

npm install --save metadata-saml2

Or

yarn add metadata-saml2

Usage

Parsing from an XML file:

const { parseIDPMetadataFromFile } = require('metadata-saml2')

const metadata = await parseIDPMetadataFromFile('metadata.xml')
console.log(metadata)
/*
  Output:
  {
    entityId: 'https://sts.windows.net/12345678-1234-1234-1234-123456789012/',
    X509Certificates: ['example-cert'],
    HTTPRedirect: 'https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/saml2',
    HTTPPost: 'https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/saml2'
  }
 */

Parsing from an XML string:

const { parseIDPMetadataFromString } = require('metadata-saml2')

const xmlString = 'read the xml from a file or stream'  
const metadata = await parseIDPMetadataFromString(xmlString)
console.log(metadata)
/*
  Output:
  {
    entityId: 'https://sts.windows.net/12345678-1234-1234-1234-123456789012/',
    X509Certificates: ['example-cert'],
    HTTPRedirect: 'https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/saml2',
    HTTPPost: 'https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/saml2'
  }
 */

Parsing the certificate:

const { parseCertificate } = require('metadata-saml2')

const certString = 'read the xml from a file or stream'  
const cert = parseCertificate(certString)
console.log(cert)
/*
  Output:
  {
    issuer: {
      C: 'AU',
      O: 'Internet Widgits Pty Ltd',
      ST: 'Some-State'
    },
    subject: {
      C: 'AU',
      O: 'Internet Widgits Pty Ltd',
      ST: 'Some-State'
    },
    valid_from: 'Aug  1 13:44:57 2018 GMT',
    valid_to: 'Aug  1 13:44:57 2019 GMT'
  }
*/

/metadata-saml2/

    Package Sidebar

    Install

    npm i metadata-saml2

    Weekly Downloads

    1,700

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    5.31 kB

    Total Files

    8

    Last publish

    Collaborators

    • liad.brettler
    • litalwe
    • inna_karpasas
    • giladozer
    • machine-user-torii
    • levitorii
    • rona.fainshtein
    • noy_benda
    • zhyubh321
    • maggertorii
    • bar.lotem
    • tomer.yemini
    • shmuel-torii
    • morhasid
    • netanelhugi.torii
    • sagi.barak
    • berzniz
    • ofirmalka
    • arbeli
    • karen-torii
    • ziv.erlichson
    • ohad_tutay
    • zivsini