@noction/tacacs-plus
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

@noction/tacacs-plus

npm version npm downloads bundle License

Description

Node.js Tacacs+ client.

Install

npm

npm i @noction/tacacs-plus

yarn

yarn add @noction/tacacs-plus

pnpm

pnpm add @noction/tacacs-plus

Usage

import type { AuthenType } from '@noction/tacacs-plus'
import { AUTHEN_TYPES, Client } from '@noction/tacacs-plus'

const client = new Client({
  host: '127.0.0.1',
  port: 49,
  secret: 'tac_test',
  // Your application logger (Optional)
  logger: {
    log: console.log,
    // If you provide a debug logger, it will log the sent and received packets
    debug: console.debug,
    error: console.error,
    warn: console.warn,
  },
})

// Example Authentication

try {
  const res = await client.authenticate({
    username: 'test_login',
    password: 'test_login_password',
    authenType: AUTHEN_TYPES.TAC_PLUS_AUTHEN_TYPE_ASCII,
  })

  console.log(res)
}
// Every status, except PASS will be thrown as an Error
catch (err) {
  console.log(err)
}

// Example Authorization

try {
  const res = await client.authorize({
    username: 'test_login',
    services: ['idk'],
  })

  console.log(res)
}
// Every status, except PASS_ADD will be thrown as an Error
catch (err) {
  console.log(err)
}

Supporting

  1. Authentication
  2. Authorization

Authentication types supported

  • TAC_PLUS_AUTHEN_TYPE_ASCII
  • TAC_PLUS_AUTHEN_TYPE_PAP
  • TAC_PLUS_AUTHEN_TYPE_CHAP

Not supporting

  1. Accounting

License

MIT License © 2024-PRESENT Noction

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i @noction/tacacs-plus

    Weekly Downloads

    9

    Version

    0.0.9

    License

    MIT

    Unpacked Size

    136 kB

    Total Files

    8

    Last publish

    Collaborators

    • terrarium789
    • melrose1
    • lwvemike
    • 50rayn