Comments (2)
Hi Vikas,
Loo into below URL. This may helps you to generate, calculate Digest value and Signature Value.
https://stackoverflow.com/questions/23394654/signing-a-xml-document-with-x509-certificate
from libsaml.
This library was first created to work with DigiD so it's relatively easy to make it happen. You just need to know what to configure :)
In order to connect to DigiD, you have to deliver the SAML metadata which contains the entity id and the signing and encryption certificates.
The signature value and digest value will be automatically filled in if you sign the Metadata object with your private key.
First make sure you configure your Saml store where the metadata from DigiD is located and your private key is configured
Saml.setup do |config|
config.register_store :file, Saml::ProviderStores::File.new("config/metadata", "config/ssl/key.pem"), default: true
end
SAML metadata or entity descriptors can be made like this:
def entity_descriptor
signing_key_descriptor = Saml::Elements::KeyDescriptor.new(certificate: "<PEM>", use: 'signing')
encryption_key_descriptor = Saml::Elements::KeyDescriptor.new(certificate: "<PEM>", use: 'encryption')
assertion_consumer_service = Saml::Elements::SPSSODescriptor::AssertionConsumerService.new(
binding: Saml::ProtocolBinding::HTTP_ARTIFACT,
index: 0,
location: "<receive artifact url>"
)
single_logout_service = Saml::Elements::SPSSODescriptor::SingleLogoutService.new(
location: "<receive logout url>",
binding: Saml::ProtocolBinding::HTTP_REDIRECT
)
sp_sso_descriptor = Saml::Elements::SPSSODescriptor.new(
assertion_consumer_services: [assertion_consumer_service],
single_logout_services: [single_logout_service],
key_descriptors: [signing_key_descriptor, encryption_key_descriptor]
)
entity_descriptor = Saml::Elements::EntityDescriptor.new(entity_id: "<entity_id>")
entity_descriptor.sp_sso_descriptor = sp_sso_descriptor
entity_descriptor
end
Make sure you change values to your specific case.
You can sign any message with the util function
Saml::Util.sign_xml(entity_descriptor)
For the implementation of the Service Provider, you can follow the example in the readme.
from libsaml.
Related Issues (20)
- what should be the identity id with uri in idp and sp HOT 4
- Provide access to ResponseLocation property HOT 2
- Sign using SHA1 HOT 6
- xmldsig dependency issue HOT 6
- SOAP binding not checking for WantAuthnRequestsSigned HOT 1
- Support multiple entity descriptors in metadata when using Url ProviderStore HOT 1
- KeyInfo node in EncryptedData node HOT 5
- chomp vs gsub("\n", "") on Base64 encoding HOT 2
- ECP profile support? HOT 7
- Support for SAML responses where only the assertion is signed HOT 2
- Support version of rails <= 4.2 HOT 1
- Onelogin: undefined method `canonicalize' for nil:NilClass HOT 18
- Questions about documentation HOT 20
- Azure AADSTS700016: Application with identifier 'https://sts.windows.net/xxxx-xxxx-xxxx/' was not found in the directory 'xxxx-xxxx-xxxx'. HOT 6
- Question about SAML Response validation HOT 1
- Redundant use of XmlMini_REXML HOT 2
- Add element SessionNotOnOrAfter HOT 1
- RSpec fails after upgrading(`~> 1.8`) gem `nokogiri`.
- Signature verification with multiple certificates when validating SAML responses HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsaml.