Skip to content

Commit

Permalink
Merge pull request omniauth#135 from tosch/feat/Allow_parsing_the_met…
Browse files Browse the repository at this point in the history
…adata_directly_from_idp

Chore: Add section about parsing IdP metadata to README
  • Loading branch information
md5 authored May 19, 2017
2 parents fee7537 + 9cf3e8a commit 75e1934
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ For IdP-initiated SSO, users should directly access the IdP SSO target URL. Set

A `OneLogin::RubySaml::Response` object is added to the `env['omniauth.auth']` extra attribute, so we can use it in the controller via `env['omniauth.auth'].extra.response_object`

## Metadata
## SP Metadata

The service provider metadata used to ease configuration of the SAML SP in the IdP can be retrieved from `http://example.com/auth/saml/metadata`. Send this URL to the administrator of the IdP.

Expand Down Expand Up @@ -145,6 +145,27 @@ Note that when [integrating with Devise](#devise-integration), the URL path will

* See the `OneLogin::RubySaml::Settings` class in the [Ruby SAML gem](https://github.com/onelogin/ruby-saml) for additional supported options.

## IdP Metadata

You can use the `OneLogin::RubySaml::IdpMetadataParser` to configure some options:

```ruby
require 'omniauth'
idp_metadata_parser = OneLogin::RubySaml::IdpMetadataParser.new
idp_metadata = idp_metadata_parser.parse_remote_to_hash("http://idp.example.com/saml/metadata")

# or, if you have the metadata in a String:
# idp_metadata = idp_metadata_parser.parse_to_hash(idp_metadata_xml)

use OmniAuth::Strategies::SAML,
idp_metadata.merge(
:assertion_consumer_service_url => "consumer_service_url",
:issuer => "issuer"
)
```

See the [Ruby SAML gem's README](https://github.com/onelogin/ruby-saml#metadata-based-configuration) for more details.

## Devise Integration

Straightforward integration with [Devise](https://github.com/plataformatec/devise), the widely-used authentication solution for Rails.
Expand Down
2 changes: 1 addition & 1 deletion omniauth-saml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
gem.required_ruby_version = '>= 2.1'

gem.add_runtime_dependency 'omniauth', '~> 1.3'
gem.add_runtime_dependency 'ruby-saml', '~> 1.4'
gem.add_runtime_dependency 'ruby-saml', '~> 1.4', '>= 1.4.3'

gem.add_development_dependency 'rake', '>= 10', '< 12'
gem.add_development_dependency 'rspec', '~>3.4'
Expand Down

0 comments on commit 75e1934

Please sign in to comment.