All Projects → salsify → omniauth-multi-provider-saml

salsify / omniauth-multi-provider-saml

Licence: MIT, MIT licenses found Licenses found MIT LICENSE MIT LICENSE.txt
An extension to omniauth-saml for handling multiple identity providers

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to omniauth-multi-provider-saml

Cpf cnpj
🇧🇷 Validate, generate and format CPF/CNPJ numbers. Include command-line tools.
Stars: ✭ 171 (+1121.43%)
Mutual labels:  gem
Jekyll Toc
Jekyll plugin which generates a table of contents.
Stars: ✭ 211 (+1407.14%)
Mutual labels:  gem
Api Fuzzer
API Fuzzer which allows to fuzz request attributes using common pentesting techniques and lists vulnerabilities
Stars: ✭ 238 (+1600%)
Mutual labels:  gem
Ougai
A Ruby structured logging is capable of handling a message, custom data or an exception easily and generates JSON or human readable logs.
Stars: ✭ 187 (+1235.71%)
Mutual labels:  gem
Squid
A Ruby library to plot charts in PDF files
Stars: ✭ 205 (+1364.29%)
Mutual labels:  gem
Localer
Automatic detecting missing I18n translations tool.
Stars: ✭ 219 (+1464.29%)
Mutual labels:  gem
Searchobject
Search object DSL
Stars: ✭ 152 (+985.71%)
Mutual labels:  gem
memo wise
The wise choice for Ruby memoization
Stars: ✭ 486 (+3371.43%)
Mutual labels:  gem
Gemsurance
Gem vulnerability checker using rubysec/ruby-advisory-db
Stars: ✭ 207 (+1378.57%)
Mutual labels:  gem
Victor
Ruby SVG Image Builder
Stars: ✭ 237 (+1592.86%)
Mutual labels:  gem
Flexirest
Flexirest - The really flexible REST API client for Ruby
Stars: ✭ 188 (+1242.86%)
Mutual labels:  gem
Arctic admin
Responsive Theme for ActiveAdmin
Stars: ✭ 201 (+1335.71%)
Mutual labels:  gem
Localeapp
Send and retrieve your ruby i18n localizations to the Locale translation service
Stars: ✭ 225 (+1507.14%)
Mutual labels:  gem
Instagram Crawler
Crawl instagram photos, posts and videos for download.
Stars: ✭ 178 (+1171.43%)
Mutual labels:  gem
Forest Rails
🌱 Rails Liana for Forest Admin
Stars: ✭ 247 (+1664.29%)
Mutual labels:  gem
Ordinare
Ordinare sorts gems in your Gemfile alphabetically
Stars: ✭ 153 (+992.86%)
Mutual labels:  gem
Bootsnap
Boot large Ruby/Rails apps faster
Stars: ✭ 2,480 (+17614.29%)
Mutual labels:  gem
graphql authorize
Authorization helpers for ruby-graphql fields
Stars: ✭ 23 (+64.29%)
Mutual labels:  gem
open dota api
Ruby client for Dota 2 from OpenDotaAPI
Stars: ✭ 19 (+35.71%)
Mutual labels:  gem
Unimidi
Realtime MIDI IO for Ruby
Stars: ✭ 229 (+1535.71%)
Mutual labels:  gem

This gem is deprecated in favor of the omniauth-multi-provider gem

Omniauth Multiple Provider SAML

This is a simple extension to omniauth-saml for supporting multiple identity providers based on a URL path segment e.g. dispatching requests to /auth/saml/foo to identity provider "foo" and /app/saml/bar to identity provider "bar".

Installation

Add this line to your application's Gemfile:

gem 'omniauth-multi-provider-saml'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-multi-provider-saml

Setup

I would highly recommend first getting omniauth-saml setup to work with a single identity provider before attempting to use this gem.

The setup process consists of the following steps:

  1. Add an omniauth-saml monkey patch for omniauth-saml PR #56.
  2. Configure your routes to handle SAML routes for multiple identity providers
  3. Configure omniauth-saml to choose the appropriate identity provider

Monkey Patch omniauth-saml

This step will only be necessary until omniauth-saml PR #56 merges. Place the following in an initializer:

require 'omniauth-saml'

OmniAuth::Strategies::SAML.class_eval do

  private

  def initialize_copy(orig)
    super
    @options = @options.deep_dup
  end
end

Configure SAML Routes

Add something like the following to your routes assuming you're using Rails (your actual URL structure may vary):

MyApplication::Application.routes.draw do
  match '/auth/saml/:identity_provider_id/callback',
        via: [:get, :post],
        to: 'omniauth_callbacks#saml',
        as: 'user_omniauth_callback'

  match '/auth/saml/:identity_provider_id',
        via: [:get, :post],
        to: 'omniauth_callbacks#passthru',
        as: 'user_omniauth_authorize'
end

Configure omniauth-saml to use multiple identity providers

The basic configuration looks something like this:

Rails.application.config.middleware.use OmniAuth::Builder do
  OmniAuth::SAML::MultiProvider.register(self, issuer: 'Salsify') do |identity_provider_id, rack_env|
    # Customize this code to return the appropriate SAML options for the given identity provider
    # See omniauth-saml for details on the supported options
    identity_provider = IdentityProvider.find_by!(uuid: identity_provider_id)
    identity_provider.options
  end
end

The OmniAuth::SAML::MultiProvider.register method takes a hash of static omniauth-saml options and a block to generate any request specific options. It also takes the following options:

  • identity_provider_id_regex - The regex for a valid identity provider id. Defaults to /\w+/

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/salsify/omniauth-multi-provider-saml.

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].