Sign inSign up

linyang1218/saml-proxy

By linyang1218

Updated over 5 years ago

A simple SAML2 proxy to help add SSO support

Image
1

2.2K

linyang1218/saml-proxy repository overview

saml-proxy build MIT licensed

A simple saml proxy for SSO integration

What is SAML

Security Assertion Markup Language is an open standard for exchanging authentication and authorization data between parties, in particular, between an identity provider and a service provider. SAML is an XML-based markup language for security assertions (statements that service providers use to make access-control decisions).

Why use SAML

An important use case that SAML addresses is web-browser single sign-on (SSO). Single sign-on is relatively easy to accomplish within a security domain (using cookies, for example) but extending SSO across security domains is more difficult and resulted in the proliferation of non-interoperable proprietary technologies. The SAML Web Browser SSO profile was specified and standardized to promote interoperability.

What is saml-proxy?

TLDR: Like oauth2-proxy, but for SAML. Typical SAML SSO providers include PingId, Okta, OneLogin etc.

Why use saml-proxy?

So you can easily add SSO protection without modifying existing applications.

How does it work?

TLDR:

server{
  ...
  location / {
    auth_request /auth;
    auth_request_set $saml_email $upstream_http_saml_email;
    proxy_set_header Saml-Email $saml_email;
    error_page 401 = /start?redirect=$request_uri;
    proxy_pass http://app:4567;
  }

  location /auth {
    internal;
    proxy_pass http://saml-proxy:9292;
  }

  location /start {
    proxy_pass http://saml-proxy:9292;
  }

  location /consume {
    proxy_pass http://saml-proxy:9292;
  }
}

Sequence Diagram: sequence-diagram

I want to see it in action

Take a look at saml-proxy-example

How do I configure it for my production setup

Via environment variables
Server
NameDefaultComment
RACK_ENVdevelopment
PORT9292
PUMA_MAX_THREADS5
SAML
NameRequiredComment
SAML_IDP_METADATATruePath to local file or remote url
SAML_SP_ENTITY_IDTrueYour SP_ENTITY_ID
SAML_ASSERTION_CONSUMER_SERVICE_URLTrue
SAML_CERTIFICATEFalsePath to your encryption/signing cert
SAML_PRIVATE_KEYFalsePath to your encryption/signing key
SAML_AUTHN_REQUESTS_SIGNEDFalseLikely required by your production IdP
SAML_METADATA_SIGNEDFalseLikely required by your production IdP
Mappings
NameRequiredComment
SAML_MAPPINGS_*FalseHTTP HEADER

The * is the attribute name returned by your SSO. The value is the HTTP header you want returned to nginx's auth_request

PROXY
NameRequiredComment
PROXY_HOSTFalse
PROXY_PORTFalse
PROXY_USERFalse
PROXY_PASSWORDFalse

The only time it makes outbound http call is when it tries to load idp metadata from a remote URL

NameDefaultComment
COOKIE_KEYsaml-proxy
COOKIE_PATH/
COOKIE_SECRETSecureRandom.hex(64)SET IT FOR PRODUCTION
COOKIE_EXPIRE_AFTERnilInteger in seconds. Default to session only
Via config file override

You can also put your override configs in /app/config/

Tag summary

Content type

Image

Digest

Size

57.9 MB

Last updated

over 5 years ago

docker pull linyang1218/saml-proxy:1.0