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

auth-center

v2.2.0

Published

auth center with TOTP

Downloads

96

Readme

Auth Center (OAuth2.0 + TOTP)

NPM version NPM downloads Build Status Coverage Status Dependency Status

安装

// 全局安装
npm i auth-center -g
// 非全局安装
npm i auth-center -S

功能列表

  • 配置方便、简单,UI简洁
  • 多数据库支持:MySQL、Postgres、sqlite、mariadb
  • session支持redis等
  • OAuth2.0 授权码模式
  • 密码验证增强(TOTP)
  • 自带后台管理

使用说明

完整配置文件参考:config.js

1. 采用命令行执行

$ auth-center -h

  Usage: auth-center [options] [command]


  Commands:

    init              init config
    start [options]   start server

  Options:

    -h, --help     output usage information
    -v, --version  output the version number

$ auth-center init

$ auth-center start -h

  Usage: auth-center start [options]

  start server

  Options:

    -h, --help         output usage information
    -p, --port <port>  server port
    --config <path>    custom config path
    --sync             sync database to generate tables
    --data <path>      init data with json file
    

2. 采用引入方式执行

const AuthServer = require('auth-center');

const server = AuthServer({
  domain: 'http://passport.example.com',
  orm: {
    database: 'db_auth',
    username: 'root',
    password: 'xxxx',
    dialect: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    pool: {
      maxConnections: 10,
      minConnections: 0,
      maxIdleTime: 30000
    }
  },
  mail: {
    from: '系统管理员 <[email protected]>',
    host: 'smtp.example.com',
    port: 465,
    secure: true,
    auth: {
      user: '[email protected]',
      pass: 'admin'
    }
  }
});

server.listen(3000);

server.orm.database().sync({
  force: true
}).then(() => { console.log('Sync done.'); });

开发

git clone https://github.com/d-band/auth-center.git
cd auth-center

npm install

npm run dev
npm start

参考链接

  • https://github.com/oauthjs/express-oauth-server
  • https://github.com/jaredhanson/oauth2orize
  • https://tools.ietf.org/html/rfc6749#section-4
  • https://tools.ietf.org/html/rfc6750
  • http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html
  • https://developer.github.com/v3/oauth/
  • https://github.com/guyht/notp