Socket
Socket
Sign inDemoInstall

authproxy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

authproxy

OAuth Proxy


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

OAuth 2 Reverse Proxy

Secure administration panels via a single authentication point using Google as OAuth provider.
It handles multiple domains and multiple backends at once, taking care of forwarding proper HTTP headers (X-Forwarded-For / Proto) and introducing X-Forwarded-User.
Also supports Google Apps domains.

Setting up

Follow these steps to get a 'Project' setup.
Set the 'Authorized Redirect URI' to http://<secured_domain>/authproxy/google/return

Save the 'Client ID' and 'Client Secret', they will be required to setup the proxy. The configuration looks like:

[server]
bind_ip = "0.0.0.0"
bind_port = 80
# change this
cookie_secret = "monstah"
# google apps domain, or leave it blank
auth_domain = "mysite.com"

[domains]
  [domains.example1]
  host = "admin.mysite.com"
  upstream = ["internal1.mysite.com", "internal2.mysite.com:8080"]
  client_id = "__clientID__"
  client_secret = "TWWWWz-EWWWWlxfX"

  # multiple domains
  [domains.example2]
  host = "admin.secondsite.com"
  upstream = ["internal3.mysite.com"]
  client_id = "__clientID__"
  client_secret = "TWWWWz-EWWWWlxfX"

Authproxy takes over the following routes; these will not be proxied to your application:

Login http://<secured_domain>/authproxy/google
Callback URL http://<secured_domain>/authproxy/return
User Check http://<secured_domain>/authproxy/user

A more complex deployment

Separate public site from administration via domain names. Ex: www.mysite.com (public) admin.mysite.com (private).

                      +---------------+         
                      |               |         
admin.mysite.com      |               |         
            +---------+    client     |         
            |         |               |         
            |         |               |         
            |         +-------+-------+         
            |                 |                 
            |                 |                 
    +-------v-------+         |                 
    |               |         |                 
    |               |         |                 
    |  authproxy    |         |   www.mysite.com
    |               |         |                 
    |               |         |                 
    +-------+-------+         |                 
            |                 |                 
            |                 |                 
            |         +-------v-------+         
            |         |               |         
            |         |               |         
            +---------+    site       |         
                      |               |         
                      |               |         
                      +---------------+         

This way you can either:

  • Create 2 DNS entries, one for public (pointing to backends) and one for private (pointing to authproxy).
  • Chain requests from a load-balancer, splitting public/private sites based on HTTP Host header.

Rails

Use hostname constraint in your routes.

match '/admin' => 'secret_stuff#index', :constraints => { :subdomain => 'admin' }

About headers...

node's http-proxy library downcase all headers prior forwarding. This works fine with most frameworks/http servers, but it is worth mentioning ;)

Authors

@lxfontes

Credits

Inspired by bitly's google-auth-proxy and doorman.

License

MIT

Keywords

FAQs

Package last updated on 30 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc