Socket
Socket
Sign inDemoInstall

metadata-saml2

Package Overview
Dependencies
3
Maintainers
21
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    metadata-saml2

Parse SAML metadata.xml files


Version published
Weekly downloads
1.4K
decreased by-22.15%
Maintainers
21
Created
Weekly downloads
 

Readme

Source

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'
  }
*/

FAQs

Last updated on 21 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc