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

sso-bootstrap

v1.4.6

Published

该包用于 SSO 的登陆探测, 具体流程如下, 当用户在 SSO 上已有登陆状态但是未在某 APP 例如 APP1 上登陆时.

Downloads

5

Readme

@wuhanfe/sso-bootstrap

该包用于 SSO 的登陆探测, 具体流程如下, 当用户在 SSO 上已有登陆状态但是未在某 APP 例如 APP1 上登陆时.

用户首次访问 APP1 时候, APP1 会通过 iframe 加载一个 SSO 域下的特殊的地址, 该地址包含一个空的 html 和本项目所提供的脚本.

SSO 会将临时用户信息访问授权 ticket 写入到 html 页面中, 本包下的 bootstrap.js 脚本会将其转发到调用 iframe 宿主手中.

SSO 服务器需要记录 referrer, 当 APP1 页面刷新的时候写入 onChange:true 这样确保调用者不会再走额外的刷新用户信息流程.

example

  • 用户在 SSO 已经登录, 在 APP1 上未登录
  • 用户信息修改
window.SSO = {
  ticket: 'ticket', // 携带 ticket
  noChange: null,
  origin: 'origin', // 加载 iframe 的宿主源
};
  • 用户登出
window.SSO = {
  ticket: null, // 配置 null
  onChange: null,
  origin: 'origin',
};
  • 用户在 SSO 登录同时在 APP1 也登录
window.SSO = {
  ticket: null,
  noChange: true, // 标记 noChange 为 true
  origin: 'origin',
};

注意事项

  • iframe 对应的 SSO 地址不应该配置任何缓存, 否则验证登陆过程将会失败.
  • 使用 iframe 的用户应该配置 referrer, SSO 服务应该探测 referrer 是否存在白名单中, 否则非常容易受到 xss 带来的大量流量攻击.