Sha256: dd171c0e9173e959b6b59590c07f89f3e8f36a836f0fbb78a8eee536e09f9898

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module Rack
  class Saml
    module OneloginSetting
      require 'ruby-saml'

      def saml_settings
        settings = OneLogin::RubySaml::Settings.new
        settings.assertion_consumer_service_url = @config['assertion_consumer_service_uri']
        settings.issuer = @config['saml_sp']
        if ENV['SP_CERT']
          settings.certificate = ENV['SP_CERT']
        elsif @config['sp_cert']
          settings.certificate = IO::File.open(@config['sp_cert'], 'r').read
        end
        if ENV['SP_KEY']
          settings.private_key = ENV['SP_KEY']
        elsif @config['sp_key']
          settings.private_key = IO::File.open(@config['sp_key'], 'r').read
        end
        settings.idp_sso_target_url = @metadata['saml2_http_redirect']
        settings.idp_cert = @metadata['certificate']
        settings.name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
        #settings.authn_context = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
        settings
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-saml-0.2.3 lib/rack/saml/misc/onelogin_setting.rb
rack-saml-0.2.2 lib/rack/saml/misc/onelogin_setting.rb
rack-saml-0.2.1 lib/rack/saml/misc/onelogin_setting.rb