Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify SAML encryption certificate in ruby-saml? #22

Open
mikemarsian opened this issue Apr 25, 2020 · 2 comments
Open

How to specify SAML encryption certificate in ruby-saml? #22

mikemarsian opened this issue Apr 25, 2020 · 2 comments

Comments

@mikemarsian
Copy link

mikemarsian commented Apr 25, 2020

The gem supports adding certificate and private-key info to Service Provider's metadata, but as far as I can see, that configures only signing certificate, but not encryption one. Here's the SO question I wrote on the subject. Would appreciate any assistance.
https://stackoverflow.com/questions/61427985/how-to-specify-saml-encryption-certificate-in-ruby-saml

@sunilnk19
Copy link

sunilnk19 commented May 5, 2020

If I understood correctly, You are not able to send the SAMLResponse in the encrypted form. If that is the case, when you are building the SAML response, send one more parameter

saml_response = encode_response( :encryption => encryption_opts())

def encryption_opts: 
return {
      cert: saml_request.service_provider.cert,
      block_encryption: 'aes256-cbc',
      key_transport: 'rsa-oaep-mgf1p'
    }

@mikemarsian
Copy link
Author

Thank you for the reply, but I'm not sure I understand where would this code fit. I use saml_config_hash = OneLogin::RubySaml::IdpMetadataParser.new.parse_to_hash(idp_metadata_file) to parse the SAML metadata file provided by the identity provider, and add to the resulting hash options, such as:
saml_config_hash.merge( certificate: "--- BEGIN CERTIFICATE---...", private_key: "--- BEGIN PRIVATE KEY---" )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants