Commit 0fc0290
Changed files (92)
bin
lib
saml
kit
builders
templates
spec
saml
kit
builders
support
bin/console
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
require 'bundler/setup'
require 'saml/kit'
exe/saml-kit-create-self-signed-certificate
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
require 'saml/kit'
Saml::Kit.deprecate("Use the 'saml-kit-cli' gem instead. saml-kit-create-self-signed-certificate")
exe/saml-kit-decode-http-post
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
require 'saml/kit'
Saml::Kit.deprecate("Use the 'saml-kit-cli' gem instead. saml-kit-decode-http-post")
exe/saml-kit-decode-http-redirect
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
require 'saml/kit'
Saml::Kit.deprecate("Use the 'saml-kit-cli' gem instead. saml-kit-decode-http-redirect*")
lib/saml/kit/bindings/binding.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Bindings
lib/saml/kit/bindings/http_post.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Bindings
lib/saml/kit/bindings/http_redirect.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Bindings
lib/saml/kit/bindings/url_builder.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Bindings
lib/saml/kit/builders/templates/assertion.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.Assertion(assertion_options) do
xml.Issuer issuer
signature_for(reference_id: reference_id, xml: xml)
lib/saml/kit/builders/templates/authentication_request.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.instruct!
xml.tag!('samlp:AuthnRequest', request_options) do
xml.tag!('saml:Issuer', issuer)
lib/saml/kit/builders/templates/encrypted_assertion.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.EncryptedAssertion xmlns: Saml::Kit::Namespaces::ASSERTION do
encryption_for(xml: xml) do |xml|
render assertion, xml: xml
lib/saml/kit/builders/templates/identity_provider_metadata.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.IDPSSODescriptor descriptor_options do
configuration.certificates(use: :signing).each do |certificate|
render certificate, xml: xml
lib/saml/kit/builders/templates/logout_request.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.instruct!
xml.LogoutRequest logout_request_options do
xml.Issuer({ xmlns: Saml::Kit::Namespaces::ASSERTION }, issuer)
lib/saml/kit/builders/templates/logout_response.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.instruct!
xml.LogoutResponse logout_response_options do
xml.Issuer(issuer, xmlns: Saml::Kit::Namespaces::ASSERTION)
lib/saml/kit/builders/templates/metadata.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.instruct!
xml.EntityDescriptor entity_descriptor_options do
signature_for(reference_id: id, xml: xml)
lib/saml/kit/builders/templates/response.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.instruct!
xml.Response response_options do
xml.Issuer(issuer, xmlns: Saml::Kit::Namespaces::ASSERTION)
lib/saml/kit/builders/templates/service_provider_metadata.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.SPSSODescriptor descriptor_options do
configuration.certificates(use: :signing).each do |certificate|
render certificate, xml: xml
lib/saml/kit/builders/assertion.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/authentication_request.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/encrypted_assertion.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/identity_provider_metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/logout_request.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/logout_response.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/response.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/builders/service_provider_metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Builders
lib/saml/kit/rspec/have_query_param.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'uri'
RSpec::Matchers.define :have_query_param do |key|
lib/saml/kit/rspec/have_xpath.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec::Matchers.define :have_xpath do |xpath|
match do |actual|
xml_document(actual).xpath(xpath, Saml::Kit::Document::NAMESPACES).any?
lib/saml/kit/assertion.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
class Assertion
lib/saml/kit/authentication_request.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# This class can be used to parse a SAML AuthnRequest or generate one.
lib/saml/kit/bindings.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'saml/kit/bindings/binding'
require 'saml/kit/bindings/http_post'
require 'saml/kit/bindings/http_redirect'
lib/saml/kit/buildable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Buildable
lib/saml/kit/builders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'saml/kit/xml_templatable'
require 'saml/kit/builders/assertion'
require 'saml/kit/builders/authentication_request'
lib/saml/kit/composite_metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
class CompositeMetadata < Metadata # :nodoc:
lib/saml/kit/configuration.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# This class represents the main configuration that is use for generating SAML documents.
lib/saml/kit/default_registry.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# The default metadata registry is used to fetch the metadata associated with an issuer or entity id.
lib/saml/kit/document.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
class Document
lib/saml/kit/identity_provider_metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# This class is used to parse the IDPSSODescriptor from a SAML metadata document.
lib/saml/kit/invalid_document.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# {include:file:spec/saml/invalid_document_spec.rb}
lib/saml/kit/logout_request.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# This class can be used to parse a LogoutRequest SAML document.
lib/saml/kit/logout_response.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# This class is used to parse a LogoutResponse SAML document.
lib/saml/kit/metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# The Metadata object can be used to parse an XML string of metadata.
lib/saml/kit/namespaces.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Namespaces
lib/saml/kit/null_assertion.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
class NullAssertion
lib/saml/kit/requestable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Requestable
lib/saml/kit/respondable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Respondable
lib/saml/kit/response.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# {include:file:spec/examples/response_spec.rb}
lib/saml/kit/rspec.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
require 'saml/kit/rspec/have_query_param'
require 'saml/kit/rspec/have_xpath'
lib/saml/kit/serializable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Serializable
lib/saml/kit/service_provider_metadata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
# {include:file:spec/examples/service_provider_metadata_spec.rb}
lib/saml/kit/signature.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
class Signature
lib/saml/kit/translatable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Translatable
lib/saml/kit/trustable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module Trustable
lib/saml/kit/version.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
VERSION = '1.0.9'.freeze
lib/saml/kit/xml_templatable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module XmlTemplatable
lib/saml/kit/xsd_validatable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Saml
module Kit
module XsdValidatable
lib/saml/kit.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'saml/kit/version'
require 'active_model'
lib/saml-kit.rb
@@ -1,1 +1,3 @@
+# frozen_string_literal: true
+
require 'saml/kit'
spec/saml/kit/bindings/binding_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Bindings::Binding do
subject { described_class.new(binding: Saml::Kit::Bindings::HTTP_ARTIFACT, location: location) }
spec/saml/kit/bindings/http_post_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Bindings::HttpPost do
subject { described_class.new(location: location) }
spec/saml/kit/bindings/http_redirect_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Bindings::HttpRedirect do
subject { described_class.new(location: location) }
spec/saml/kit/bindings/url_builder_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Bindings::UrlBuilder do
describe '#build' do
let(:xml) { '<xml></xml>' }
spec/saml/kit/builders/authentication_request_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::AuthenticationRequest do
subject { described_class.new(configuration: configuration) }
spec/saml/kit/builders/identity_provider_metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::IdentityProviderMetadata do
subject { described_class.new(configuration: configuration) }
spec/saml/kit/builders/logout_request_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::LogoutRequest do
subject { described_class.new(user, configuration: configuration) }
spec/saml/kit/builders/logout_response_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::LogoutResponse do
subject { described_class.new(request) }
spec/saml/kit/builders/metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::Metadata do
describe '.build' do
subject { Saml::Kit::Metadata }
spec/saml/kit/builders/response_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::Response do
subject { described_class.new(user, request, configuration: configuration) }
spec/saml/kit/builders/service_provider_metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Builders::ServiceProviderMetadata do
subject { described_class.new(configuration: configuration) }
spec/saml/kit/assertion_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Assertion do
subject do
Saml::Kit::Response.build(user, request) do |x|
spec/saml/kit/authentication_request_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::AuthenticationRequest do
subject { described_class.new(raw_xml, configuration: configuration) }
spec/saml/kit/bindings_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Bindings do
describe '.to_symbol' do
subject { described_class }
spec/saml/kit/composite_metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::CompositeMetadata do
subject { described_class.new(xml) }
spec/saml/kit/configuration_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Configuration do
describe '#generate_key_pair_for' do
subject { described_class.new }
spec/saml/kit/default_registry_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::DefaultRegistry do
subject { described_class.new }
spec/saml/kit/document_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Document do
subject do
Saml::Kit::AuthenticationRequest.build do |x|
spec/saml/kit/identity_provider_metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::IdentityProviderMetadata do
subject { described_class.new(raw_metadata) }
spec/saml/kit/invalid_document_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::InvalidDocument do
it 'is invalid' do
subject = described_class.new('<xml></xml>')
spec/saml/kit/kit_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit do
it 'has a version number' do
expect(Saml::Kit::VERSION).not_to be nil
spec/saml/kit/logout_request_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::LogoutRequest do
subject { described_class.build(user, configuration: configuration) }
spec/saml/kit/logout_response_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::LogoutResponse do
it 'exists' do
expect(described_class).to be(described_class)
spec/saml/kit/metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Metadata do
describe '.from' do
subject { described_class }
spec/saml/kit/response_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Response do
subject { described_class.build(user, request) }
spec/saml/kit/service_provider_metadata_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::ServiceProviderMetadata do
let(:entity_id) { FFaker::Internet.uri('https') }
let(:acs_post_url) { FFaker::Internet.uri('https') }
spec/saml/kit/signature_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Saml::Kit::Signature do
subject { described_class.new(signed_document.at_xpath('//ds:Signature')) }
spec/support/rspec_benchmark.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'rspec-benchmark'
RSpec.configure do |config|
spec/support/test_helpers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TestHelpers
def query_params_from(url)
Hash[query_for(url).split('&').map { |x| x.split('=', 2) }]
spec/support/user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class User
attr_reader :name_id, :attributes
spec/spec_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
Gemfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
saml-kit.gemspec
@@ -1,4 +1,6 @@
+# frozen_string_literal: true
+
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'saml/kit/version'