Comparing changes
v0.3.2
→
v0.3.3
6 commits
11 files changed
Commits
Changed files (11)
exe/saml-kit-create-self-signed-certificate
@@ -3,7 +3,7 @@ require 'saml/kit'
puts "Enter Passphrase:"
passphrase = STDIN.read.strip
-certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new(passphrase).create
+certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: passphrase)
puts "** BEGIN File Format **"
print certificate
lib/saml/kit/assertion.rb
@@ -14,6 +14,10 @@ module Saml
@configuration = configuration
end
+ def issuer
+ assertion.fetch('Issuer')
+ end
+
def name_id
assertion.fetch('Subject', {}).fetch('NameID', nil)
end
lib/saml/kit/configuration.rb
@@ -61,7 +61,7 @@ module Saml
# @param use [Symbol] the type of key pair, `:signing` or `:encryption`
# @param passphrase [String] the private key passphrase to use.
def generate_key_pair_for(use:, passphrase: SecureRandom.uuid)
- certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new(passphrase).create
+ certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: passphrase)
add_key_pair(certificate, private_key, passphrase: passphrase, use: use)
end
lib/saml/kit/namespaces.rb
@@ -19,6 +19,9 @@ module Saml
UNSPECIFIED_NAMEID = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
URI = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
VERSION_MISMATCH_ERROR = "urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"
+
+ # @deprecated Use {#::Xml::Kit::Namespace::XMLDSIG} instead of this.
+ XMLDSIG = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::Namespaces::XMLDSIG', '::Xml::Kit::Namespaces::XMLDSIG')
end
end
end
lib/saml/kit/version.rb
@@ -1,5 +1,5 @@
module Saml
module Kit
- VERSION = "0.3.2"
+ VERSION = "0.3.3"
end
end
lib/saml/kit.rb
@@ -7,6 +7,7 @@ require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/numeric/time"
require "active_support/deprecation"
require "active_support/duration"
+require "forwardable"
require "logger"
require "net/http"
require "nokogiri"
@@ -65,5 +66,10 @@ module Saml
@deprecation.deprecation_warning(message)
end
end
+
+ # @deprecated Use {#::Xml::Kit::Id} instead of this.
+ Id = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::Id', '::Xml::Kit::Id')
+ # @deprecated Use {#::Xml::Kit::Fingerprint} instead of this.
+ Fingerprint = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::Fingerprint', '::Xml::Kit::Fingerprint')
end
end
spec/saml/builders/response_spec.rb
@@ -28,6 +28,13 @@ RSpec.describe Saml::Kit::Builders::Response do
result = subject.build
expect(result).to be_valid
end
+
+ it 'includes the issuer' do
+ subject.encrypt = false
+ result = subject.build
+ expect(result.issuer).to eql(issuer)
+ expect(result.assertion.issuer).to eql(issuer)
+ end
end
describe "#to_xml" do
spec/saml/response_spec.rb
@@ -318,7 +318,7 @@ RSpec.describe Saml::Kit::Response do
let(:url) { FFaker::Internet.uri("https") }
let(:certificate) do
::Xml::Kit::Certificate.new(
- ::Xml::Kit::SelfSignedCertificate.new("password").create[0],
+ ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: "password")[0],
use: :signing
)
end
@@ -439,7 +439,7 @@ XML
end
it 'parses the encrypted assertion' do
- certificate_pem, private_key_pem = ::Xml::Kit::SelfSignedCertificate.new(password).create
+ certificate_pem, private_key_pem = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: password)
public_key = OpenSSL::X509::Certificate.new(certificate_pem).public_key
private_key = OpenSSL::PKey::RSA.new(private_key_pem, password)
spec/saml/service_provider_metadata_spec.rb
@@ -130,7 +130,7 @@ RSpec.describe Saml::Kit::ServiceProviderMetadata do
end
it 'returns false when the fingerprint does not match one of the signing certificates' do
- certificate, _ = ::Xml::Kit::SelfSignedCertificate.new('password').create
+ certificate, _ = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: 'password')
fingerprint = ::Xml::Kit::Fingerprint.new(certificate)
expect(subject.matches?(fingerprint)).to be_falsey
end
README.md
@@ -3,6 +3,7 @@
[](https://rubygems.org/gems/saml-kit)
[](https://codeclimate.com/github/saml-kit/saml-kit)
[](https://travis-ci.org/saml-kit/saml-kit)
+[](https://hakiri.io/github/saml-kit/saml-kit/master)
Saml::Kit is a library with the purpose of creating and consuming SAML
documents. It supports the HTTP Post and HTTP Redirect bindings. It can
saml-kit.gemspec
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "activemodel", ">= 4.2.0"
spec.add_dependency "nokogiri", "~> 1.8"
- spec.add_dependency "xml-kit", ">= 0.1.1"
+ spec.add_dependency "xml-kit", "~> 0.1"
spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "ffaker", "~> 2.7"
spec.add_development_dependency "rake", "~> 10.0"