npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-sp-auth-config

v3.0.5

Published

Config options builder for node-sp-auth (SharePoint Authentication in Node.js)

Downloads

59,808

Readme

node-sp-auth-config - Config options builder for node-sp-auth (SharePoint Authentication in Node.js)

NPM

npm version Downloads Actions Status FOSSA Status Gitter chat

node-sp-auth-config provides wizard-like approach for building and managing config files for node-sp-auth (Node.js to SharePoint unattended http authentication). Includes CLI for generating config files from a command prompt.

Versions supported:

  • SharePoint Online
  • SharePoint 2019
  • SharePoint 2016
  • SharePoint 2013
  • SharePoint 2010

Authentication options:

  • SharePoint Online:
    • User credentials (SAML/ADFS)
    • Add-In Only permissions
    • On-Demand authentication (using Electron popup)
  • SharePoint 2019, 2016, 2013:
    • User credentials (NTLM, NTLM v2)
    • ADFS user credentials
    • Form-based authentication (FBA)
    • Form-based authentication (Forefront TMG)
    • Add-In Only permissions
    • On-Demand authentication (using Electron popup)
  • SharePoint 2010:
    • User credentials (NTLM, NTMLv2)
    • Form-based authentication (FBA)
    • Form-based authentication (Forefront TMG)

Config layer and auth support Office 365 Dedicated (SPO on a custom domain) as well.


How to use

Install

npm install node-sp-auth-config --save

or install globally to use as CLI:

npm install node-sp-auth-config -g

Usage as CLI

sp-auth init --path ./config/private.config.json
sp-auth --help # for help about parameters

Usage in TypeScript

import { AuthConfig } from 'node-sp-auth-config';

const authConfig = new AuthConfig({
  configPath: './config/private.json',
  encryptPassword: true,
  saveConfigOnDisk: true
});

authConfig.getContext()
  .then((context) => {
    console.log(JSON.stringify(context, null, 2));
    // context.authOptions - node-sp-auth authentication options
  })
  .catch(console.warn);

Usage in JavaScript

const AuthConfig = require('node-sp-auth-config').AuthConfig;

const authConfig = new AuthConfig({
  configPath: './config/private.json',
  encryptPassword: true,
  saveConfigOnDisk: true
});

authConfig.getContext()
  .then((context) => {
    console.log(JSON.stringify(context, null, 2));
    // context.authOptions - node-sp-auth authentication options
  })
  .catch(console.warn);

Initiation parameters

| Parameter | Default value | Description | | --- | --- | --- | | configPath | './config/private.json' | Path to auth config .json | | encryptPassword | true | Encrypt password to a machine-bind hash | | saveConfigOnDisk | true | Save config .json to disk | | forcePrompts | false | Force parameters prompts | | headlessMode | false | Prevents interactive prompts - for headless, CI/CD processes | | defaultConfigPath | empty | Path to .json config, parameters from which are placed as defaults | | authOptions | empty | Any valid node-sp-auth options |

Production runtime

Headless mode

When using in a headless mode, in case of missing parameters, one can expect non-interactive behavior with no prompts but graceful exit with corresponding error output.

This can be achieved by providing headlessMode settings property is equal to true.

The headless mode also automatically configured when NODE_ENV (or SPAUTH_ENV) environment variable is equal to production.

Environment variables

All the parameters which are usually stored in private.json can be defined also using environment variables. Environment variables started with SPAUTH_ prefix are recognized with the library. The second part of the name is an actual name of the node-sp-auth credentials property yet in uppercase (e.g. SPAUTH_SITEURL, SPAUTH_USERNAME, SPAUTH_PASSWORD).

Along with credentials props these service variables are used:

| Variable | Description | | --- | --- | | NODE_ENV | When equal to production forces headlessMode. | | SPAUTH_ENV | When equal to production forces headlessMode. Overwrites NODE_ENV. | | SPAUTH_FORCE | Makes SPAUTH_{CREDENTIALS} variables take precedence over those possibly stored in private.json. |

Configuring CI/CD

Checkout this end-to-end sample.

License

FOSSA Status