GithubHelp home page GithubHelp logo

doytsujin / passport Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hanabix/passport

0.0 1.0 0.0 182 KB

A web gateway for enterprise internal application supports authentication by scaning QR code with APP

License: Apache License 2.0

Scala 100.00%

passport's Introduction

CI Publish Docker Latest Coveralls github Codacy Badge

Passport 是一个超轻量级统一认证网关, 面向使用 钉钉 或是 企业微信 的创业团队提供手机扫码登录访问内部服务.

overview diagram

seq diagram

跑起来

curl -LkO https://github.com/zhongl/passport/raw/master/docker-compose.yml 
curl -LkO https://github.com/zhongl/passport/raw/master/app.conf
DOMAIN=foo.bar docker-compose up -d
curl -k -v https://localhost -H 'Host: www.foo.bar' -H 'Cookie: jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJwYXNzcG9ydCIsIm5hbWUiOiJ6aG9uZ2wiLCJleHAiOjE4NjYxNzI3MjV9.FomLr4SgRvHuI6iUnVZc2-Q9YQbNrh4eDWGbM09xoC8'

配置

钉钉

// app.conf
include "dingtalk.conf"

cookie {
    domain = ".company.internal.domain"
    secret = "JWT签名密钥"
}

dingtalk {
    micro {
        appkey = "微应用的appkey"
        secret = "微应用的appsecret"
    }
    
    mobile {
        appid = "移动接入应用的appid"
        secret = "移动接入应用的appSecret"
    }

    authorization.redirect = "https://your.company.domain/authorized"
}
  1. 参见开发企业内部应用, 创建微应用;
  2. 参见扫码登录第三方Web网站, 创建移动接入应用.

企业微信

// app.conf
include "wechat.conf"

cookie {
    domain = ".company.internal.domain"
    secret = "JWT签名密钥"
}

wechat {
    corp = "企业corpid"
    secret = "企业corpsecret"
    agent = "应用的agentid"

    authorization.redirect = "https://your.company.domain/authorized"
}

参见企业内部开发, 创建应用.

Echo调试

若需要在真正部署之前进行调试验证, 可在运行时指定-e:

docker run --rm -it zhongl/passport:latest -e

开启Echo模式, 显示请求文本.

docker run --rm zhongl/passport:latest --help 查看更多帮助

应用集成

扫码登录后, Passport 会产生一个加签过的 JWT Token 作为 Cookie, 其中包含当前用户的认证信息(钉钉和微信略有差异). 此 Cookie 也会在后续的请求中透传到合法目标服务器, 做进一步授权处理.

认证信息参见Platforms.scala

References

passport's People

Contributors

zhongl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.