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

@wx-sab/sso-login

v0.1.24

Published

快速接入单点登录平台

Downloads

227

Readme

统一登录平台快速接入

Install

pnpm add @wx-sab/sso-login

Feature

  • [x] 支持自定义认证中心地址
  • [x] 支持自定义 token 换取方法
  • [x] 支持自定义 token key
  • [x] 支持自定义存储器,默认存放位置 localStorage
  • [x] 支持一键禁用 sso 登录
  • [x] 支持容灾降级,认证中心服务异常回退为项目本身登录
  • [x] 支持代理
  • [x] 允许根据条件来判断是否跳转sso

Usage


import { SSOLogin } from '@wx-sab/sso-login'

const sso = new SSOLogin({
  // 认证服务地址
  authBaseHost?: string
  // 代理服务器
  proxy?: string
  // 环境(dev\qa\pre\prod),
  // 内置四个环节的认证服务地址
  // 如果未提供 authBaseHost,可以通过传入env来自动获取
  // 如果提供了 authBaseHost,则以 authBaseHost 为准
  env?: 'dev' | 'qa' | 'pre' | 'prod'
  // 获取登录中心地址
  getSSOLoginUrl(config: Partial<SSOLoginConfig>): string | Promise<string>
  // 根据ticket换取 sab-token
  getSabTokenByTicket(ticket: string, config: Partial<SSOLoginConfig>): string | Promise<string>
  // sso 退出登录
  ssoLogout?(token: string, config: Partial<SSOLoginConfig>): any;

  // 退出登录前
  onBeforeLogout?(config: Partial<SSOLoginConfig>): void

  // 自动容灾降级,不使用 sso 登录, 默认true
  enableTierDown?: boolean
  // 禁用 sso 登录
  disabled?: boolean
  // 缓存的token key,默认 sab-token
  tokenKey: string
  // 缓存的位置, 默认 localStorage
  storage?: StorageLike

  // 某些条件下不进行 sso 登录
  excludes?: (config: Partial<SSOLoginConfig>) => boolean | Promise<boolean>
})

// SKD初始化
// 如果没有登陆则会自动发起登录
sso.init()

// 手动调用登录
sso.login()

// 退出登录
sso.lougout()