New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@kelchy/auth

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kelchy/auth

## This module wraps helper functions around authentication and authorization to simplify development

latest
npmnpm
Version
1.1.2
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Auth

This module wraps helper functions around authentication and authorization to simplify development

  • Requires
tough-cookie
google-auth-library
axios
  • Basic Initialization - freeipa or google client
const Auth = require('@kelchy/auth')
//const auth = new Auth.Freeipa('sg', 'telco', 'domain.com')
const auth = new Auth.Google('sg', 'telco', 'domain.com')
  • Custom client options - override baseUrl for freeipa instead of the tenant specific default endpoints
const auth = new Auth.Freeipa('sg', 'telco', 'domain.com', { baseUrl: 'https://freeipa.domain.net' })
  • Custom client options - override clientId for google instead of the tenant specific default clientId
const auth = new Auth.Google('sg', 'telco', 'domain.com', { clientId: 'xxxx123yyy456zzz789' })
  • Custom client options - override default 1 hour cache time to 30 mins (cache only applicable to isTokenValid for now)
const gauth = new Auth.Google('sg', 'telco', 'domain.com', { cache: 30 * 60 * 1000 })
const fauth = new Auth.Freeipa('sg', 'telco', 'domain.com', { cache: 30 * 60 * 1000 })
  • Custom client options - disable cache
const gauth = new Auth.Google('sg', 'telco', 'domain.com', { cache: 0 })
const fauth = new Auth.Freeipa('sg', 'telco', 'domain.com', { cache: 0 })
  • Turn internal logging on
const Log = require('@kelchy/log')
const auth = new Auth.Google('sg', 'telco', 'domain.com', { log: new Log.Standard() })
  • supported methods
generateToken(id, secret) - create an access token, given the credentials
isTokenValid(token, options) - check if access token is valid, optional { fresh: true } to force library to fetch from IAM provider
isOperationAllowed(token, scope) - check if scope is allowed given the token
getMetadata(token) - get metadata associated with token

FAQs

Package last updated on 07 Aug 2022

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