Socket
Book a DemoInstallSign in
Socket

brightspace-auth-validation

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brightspace-auth-validation

Validate an incoming Brightspace JWT

latest
Source
npmnpm
Version
9.0.1
Version published
Weekly downloads
382
-49.47%
Maintainers
1
Weekly downloads
 
Created
Source

brightspace-auth-validation

Usage

'use strict';

const http = require('http');
const validator = new (require('brightspace-auth-validation'))();

const server = http
	.createServer((req, res) => {
		validator
			.fromHeaders(req.headers)
			.then(token => {
				// token is a BrightspaceAuthToken instance
				res.statusCode = 201;
				res.end('Hi!\n');
			}, e => {
				console.error(e);
				res.statusCode = e.status || 403;
				res.end('Sorry, can\'t let you in!\n');
			});
	})
	.listen(3000);

API

new AuthTokenValidator([Object options]) -> AuthTokenValidator

Option: issuer String (https://auth.brightspace.com/core)

You may optionally specify the auth instance to connect to.

...new AuthTokenValidator({ issuer: 'https://auth.brightspace.com/core' });
Option : maxClockSkew Number (300)

You may optionally specify the allowed clock skew, in seconds, when validating time-based claims.

Option : maxKeyAge Number (18000)

Deprecated soon

You may optionally specify the length of time, in seconds, to trust a given key without re-confirmation.

Option: name String

Recommended. You may optionally specify a name to send as part of the user agent when fetching keys from the issuer. Assists in tracking issues and RCAs.

...new AuthTokenValidator({ name: 'johns-service' })

.fromHeaders(Object headers) -> Promise<BrightspaceAuthToken>

Given the incoming request headers, will attempt to extract and validate the authorization signature.

.fromSignature(String signature) -> Promise<BrightspaceAuthToken>

Validates an authorization signature.

.validateConfiguration() -> Promise<True>

Will attempt to interact with the provided auth instance. Resolves if all is well, or rejects with an error.

FAQs

Package last updated on 07 May 2025

Did you know?

Socket

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