MXSH-Dev / nginx-njs-oidc-proxy

An alternative of oauth2_proxy implemented with njs scripting language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nginx-njs-oidc-proxy

An alternative of oauth2_proxy implemented with njs scripting language. There is a similar implementation for NGINX Plus, but this can also work on open source NGINX.

Try It!

  1. Edit nginx/js/config.js and fill clientId and clientSecret
    • Create OAuth 2.0 Client ID here
    • Add http://localhost/oauth2/callback to Authorized redirect URIs
  2. Run docker-compose up -d
  3. Open http://localhost/
  4. Login with your gmail account
  5. It works!

Tips

  • You must set cookieSecret on production environment.
  • You can implement custom auth-strategy, see nginx/js/handler.js and nginx/js/acl.js.
  • You can pass some user profile to backend, see an end of authHandler function.
  • Initial implementation uses Google as an OpenID provider. Other providers also can be used.

About

An alternative of oauth2_proxy implemented with njs scripting language

License:MIT License


Languages

Language:JavaScript 86.8%Language:Dockerfile 9.7%Language:PHP 3.5%