Created
August 5, 2016 04:55
-
-
Save prcongithub/4ed9d58632153a354af7a9952ac399b3 to your computer and use it in GitHub Desktop.
SAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IdPSettingsAdapter | |
def self.settings(company) | |
idp_metadata_parser = OneLogin::RubySaml::IdpMetadataParser.new | |
settings = idp_metadata_parser.parse_remote(company.saml_metadata_url) | |
settings.assertion_consumer_service_url = "https://api.local.ur-nl.com:6080/users/saml/auth" | |
settings.issuer = "https://api.local.ur-nl.com:6080/saml/metadata" | |
settings.name_identifier_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" | |
settings.authn_context = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport" | |
settings | |
end | |
end | |
company = Company.find(2) | |
jruby-1.7.4 :004 > company.saml_metadata_url | |
=> "http://companies.jombaylocal.com/GoogleIDPMetadata-yournextleap.com.xml" | |
saml_settings = IdPSettingsAdapter.settings(company) | |
auth_request = OneLogin::RubySaml::Authrequest.new | |
auth_request.create(saml_settings) | |
jruby-1.7.4 :007 > auth_request.create(saml_settings) | |
=> "https://accounts.google.com/o/saml2/idp?idpid=C03o79ung&SAMLRequest=hVLLbtswEPwV3XjS07IjE5YLQUYBA2lgOGkOvQQbauMQoEiVSybu35dS4kKHJD0QBHZnZofD3RD0auCNd8%2F6iL89kosaIrROGt0aTb5He4v2RQr8ebyu2bNzA%2FE0hUEmyghQibexVokwPV9lVZb6QKZ0lE0hqLJoFzSlhlFwRhfCeO0oORlzUjjSUzOxilR2w7dwZFe32cJcrb0%2BsWi%2Fq9lD3lVYFcUqXuCijMsrUcYA1SLOEUWJFTyu1usAJfK41%2BRAu5oVWb6KsyrOlndZyZdLnhW%2FWHQfTE6GiiRj0blXmvg4vWbeam6AJHENPRJ3gt82P655AHK4JDOnDF9zBmucEUax7WZE88md3f43xynBHh104GCTzrmbt0%2B7CbP2u4NRUvyJGqXMa2sRHNbMWY8s%2Bm5sD%2B5zd3mSTxXZxU8TlGMPUjVdZ5GIpZc573uB3bQlYSkcnl3Umn4AK2kMEc8g3OWBc1SrQmRHfNp%2BmargYsSF8iFcr8Z2hxAaijDyzoKmwVj3nsCH4m%2B9T4z%2B6853fPsX" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment