saml_idp_metadata 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.circleci/config.yml +17 -0
- data/.github/CODEOWNERS +37 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +26 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +72 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/saml_idp_metadata.rb +8 -0
- data/lib/saml_idp_metadata/parser.rb +118 -0
- data/lib/saml_idp_metadata/version.rb +5 -0
- data/saml_idp_metadata.gemspec +34 -0
- metadata +146 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4eaf9eb4a8e3cc538814350cf3361459eafc949285d7e770ada043c7a9f731c2
|
|
4
|
+
data.tar.gz: d6710bb713c25deea9a2f223fddb2d83795d5267768da8acbf8dc73f4a8d9f36
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a4dd4c1c62ae12178f6a99a43880332c07cef4dd1b395789ea675211d85c606b5a45a78b36ed1bfcec77c77f12332d01b25925c3f8eda8f2fa2c1b6a692d5e68
|
|
7
|
+
data.tar.gz: 4f061bdbde0fecde11439cf5d77b0ec0d9013feec83d5dc341a19fe7c4680c75eca078adee25c68c1aed87bcef14ba30ac67c4c19ef6805e1ac2d1e58c354dcb
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This is a comment.
|
|
2
|
+
# Each line is a file pattern followed by one or more owners.
|
|
3
|
+
|
|
4
|
+
# These owners will be the default owners for everything in
|
|
5
|
+
# the repo. Unless a later match takes precedence,
|
|
6
|
+
# @global-owner1 and @global-owner2 will be requested for
|
|
7
|
+
# review when someone opens a pull request.
|
|
8
|
+
* @tknzk
|
|
9
|
+
|
|
10
|
+
# Order is important; the last matching pattern takes the most
|
|
11
|
+
# precedence. When someone opens a pull request that only
|
|
12
|
+
# modifies JS files, only @js-owner and not the global
|
|
13
|
+
# owner(s) will be requested for a review.
|
|
14
|
+
# *.js @js-owner
|
|
15
|
+
|
|
16
|
+
# You can also use email addresses if you prefer. They'll be
|
|
17
|
+
# used to look up users just like we do for commit author
|
|
18
|
+
# emails.
|
|
19
|
+
# *.go docs@example.com
|
|
20
|
+
|
|
21
|
+
# In this example, @doctocat owns any files in the build/logs
|
|
22
|
+
# directory at the root of the repository and any of its
|
|
23
|
+
# subdirectories.
|
|
24
|
+
# /build/logs/ @doctocat
|
|
25
|
+
|
|
26
|
+
# The `docs/*` pattern will match files like
|
|
27
|
+
# `docs/getting-started.md` but not further nested files like
|
|
28
|
+
# `docs/build-app/troubleshooting.md`.
|
|
29
|
+
# docs/* docs@example.com
|
|
30
|
+
|
|
31
|
+
# In this example, @octocat owns any file in an apps directory
|
|
32
|
+
# anywhere in your repository.
|
|
33
|
+
# apps/ @octocat
|
|
34
|
+
|
|
35
|
+
# In this example, @doctocat owns any file in the `/docs`
|
|
36
|
+
# directory in the root of your repository.
|
|
37
|
+
# /docs/ @doctocat
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v1
|
|
12
|
+
- name: Set up Ruby 2.6
|
|
13
|
+
uses: actions/setup-ruby@v1
|
|
14
|
+
with:
|
|
15
|
+
ruby-version: 2.6.x
|
|
16
|
+
- name: Build and test
|
|
17
|
+
run: |
|
|
18
|
+
gem install bundler -v 2.0.2
|
|
19
|
+
bundle install
|
|
20
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2019-11-25 10:02:54 +0900 using RuboCop version 0.76.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
Metrics/AbcSize:
|
|
11
|
+
Max: 21
|
|
12
|
+
|
|
13
|
+
# Offense count: 2
|
|
14
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
15
|
+
# ExcludedMethods: refine
|
|
16
|
+
Metrics/BlockLength:
|
|
17
|
+
# Max: 69
|
|
18
|
+
Exclude:
|
|
19
|
+
- 'spec/**/*'
|
|
20
|
+
|
|
21
|
+
# Offense count: 29
|
|
22
|
+
# Cop supports --auto-correct.
|
|
23
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
24
|
+
# URISchemes: http, https
|
|
25
|
+
Metrics/LineLength:
|
|
26
|
+
Max: 128
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at tkm.knzk@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
saml_idp_metadata (0.1.0)
|
|
5
|
+
activesupport
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
activesupport (6.0.1)
|
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
12
|
+
i18n (>= 0.7, < 2)
|
|
13
|
+
minitest (~> 5.1)
|
|
14
|
+
tzinfo (~> 1.1)
|
|
15
|
+
zeitwerk (~> 2.2)
|
|
16
|
+
ast (2.4.0)
|
|
17
|
+
coderay (1.1.2)
|
|
18
|
+
concurrent-ruby (1.1.5)
|
|
19
|
+
diff-lcs (1.3)
|
|
20
|
+
i18n (1.7.0)
|
|
21
|
+
concurrent-ruby (~> 1.0)
|
|
22
|
+
jaro_winkler (1.5.4)
|
|
23
|
+
method_source (0.9.2)
|
|
24
|
+
minitest (5.13.0)
|
|
25
|
+
parallel (1.19.1)
|
|
26
|
+
parser (2.6.5.0)
|
|
27
|
+
ast (~> 2.4.0)
|
|
28
|
+
pry (0.12.2)
|
|
29
|
+
coderay (~> 1.1.0)
|
|
30
|
+
method_source (~> 0.9.0)
|
|
31
|
+
rainbow (3.0.0)
|
|
32
|
+
rake (13.0.1)
|
|
33
|
+
rspec (3.9.0)
|
|
34
|
+
rspec-core (~> 3.9.0)
|
|
35
|
+
rspec-expectations (~> 3.9.0)
|
|
36
|
+
rspec-mocks (~> 3.9.0)
|
|
37
|
+
rspec-core (3.9.0)
|
|
38
|
+
rspec-support (~> 3.9.0)
|
|
39
|
+
rspec-expectations (3.9.0)
|
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
41
|
+
rspec-support (~> 3.9.0)
|
|
42
|
+
rspec-mocks (3.9.0)
|
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
+
rspec-support (~> 3.9.0)
|
|
45
|
+
rspec-support (3.9.0)
|
|
46
|
+
rubocop (0.76.0)
|
|
47
|
+
jaro_winkler (~> 1.5.1)
|
|
48
|
+
parallel (~> 1.10)
|
|
49
|
+
parser (>= 2.6)
|
|
50
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
51
|
+
ruby-progressbar (~> 1.7)
|
|
52
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
|
53
|
+
ruby-progressbar (1.10.1)
|
|
54
|
+
thread_safe (0.3.6)
|
|
55
|
+
tzinfo (1.2.5)
|
|
56
|
+
thread_safe (~> 0.1)
|
|
57
|
+
unicode-display_width (1.6.0)
|
|
58
|
+
zeitwerk (2.2.1)
|
|
59
|
+
|
|
60
|
+
PLATFORMS
|
|
61
|
+
ruby
|
|
62
|
+
|
|
63
|
+
DEPENDENCIES
|
|
64
|
+
bundler (~> 1.17)
|
|
65
|
+
pry
|
|
66
|
+
rake
|
|
67
|
+
rspec
|
|
68
|
+
rubocop
|
|
69
|
+
saml_idp_metadata!
|
|
70
|
+
|
|
71
|
+
BUNDLED WITH
|
|
72
|
+
1.17.3
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Takumi KANZAKI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# SamlIdpMetadata
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/saml_idp_metadata`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'saml_idp_metadata'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install saml_idp_metadata
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tknzk/saml_idp_metadata. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
|
+
|
|
37
|
+
## Code of Conduct
|
|
38
|
+
|
|
39
|
+
Everyone interacting in the SamlIdpMetadata project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tknzk/saml_idp_metadata/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'saml_idp_metadata_parser'
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
+
# require "pry"
|
|
12
|
+
# Pry.start
|
|
13
|
+
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_support/core_ext'
|
|
4
|
+
module SamlIdpMetadata
|
|
5
|
+
#
|
|
6
|
+
# SAML IdP metadata parser
|
|
7
|
+
#
|
|
8
|
+
class Parser
|
|
9
|
+
attr_reader :xml, :xmlns, :entity_id, :sso_http_redirect_url, :sso_http_post_url, :slo_url, :x509_certificate
|
|
10
|
+
|
|
11
|
+
def initialize(xml:)
|
|
12
|
+
@xml = xml
|
|
13
|
+
@hash = Hash.from_xml(xml)
|
|
14
|
+
|
|
15
|
+
@xmlns = nil
|
|
16
|
+
@entity_id = nil
|
|
17
|
+
@sso_http_redirect_url = nil
|
|
18
|
+
@sso_http_post_url = nil
|
|
19
|
+
@slo_url = nil
|
|
20
|
+
@x509_certificate = nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.call(xml:)
|
|
24
|
+
new(xml: xml).call
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def call
|
|
28
|
+
@xmlns = parse_xmlns
|
|
29
|
+
|
|
30
|
+
@entity_id = parse_entity_id
|
|
31
|
+
@sso_http_redirect_url = parse_sso_http_redirect_url
|
|
32
|
+
@sso_http_post_url = parse_sso_http_post_url
|
|
33
|
+
@slo_url = parse_slo_url
|
|
34
|
+
@x509_certificate = parse_x509_certificate
|
|
35
|
+
|
|
36
|
+
self
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def validate_xmlns
|
|
40
|
+
xmlns == 'urn:oasis:names:tc:SAML:2.0:metadata'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def ensure_params?
|
|
44
|
+
entity_id.present? && (sso_http_redirect_url.present? && sso_http_post_url.present?) && x509_certificate.present?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def build_params
|
|
48
|
+
{
|
|
49
|
+
entity_id: entity_id,
|
|
50
|
+
sso_http_redirect_url: sso_http_redirect_url,
|
|
51
|
+
sso_http_post_url: sso_http_post_url,
|
|
52
|
+
certificate: x509_certificate,
|
|
53
|
+
slo_url: slo_url,
|
|
54
|
+
metadata: xml
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def entity_descriptor
|
|
61
|
+
@hash['EntityDescriptor']
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def parse_entity_id
|
|
65
|
+
entity_descriptor['entityID']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def parse_xmlns
|
|
69
|
+
entity_descriptor.key?('xmlns:md') ? entity_descriptor['xmlns:md'] : entity_descriptor['xmlns']
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def parse_sso_http_redirect_url
|
|
73
|
+
return nil if entity_descriptor.dig('IDPSSODescriptor', 'SingleSignOnService').nil?
|
|
74
|
+
|
|
75
|
+
single_signon_services = entity_descriptor['IDPSSODescriptor']['SingleSignOnService']
|
|
76
|
+
|
|
77
|
+
return single_signon_services['Location'] if single_signon_services.is_a?(Hash)
|
|
78
|
+
|
|
79
|
+
single_signon_services.each do |service|
|
|
80
|
+
return service['Location'] if service['Binding'] == 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def parse_sso_http_post_url
|
|
85
|
+
return nil if entity_descriptor.dig('IDPSSODescriptor', 'SingleSignOnService').nil?
|
|
86
|
+
|
|
87
|
+
single_signon_services = entity_descriptor['IDPSSODescriptor']['SingleSignOnService']
|
|
88
|
+
|
|
89
|
+
return single_signon_services['Location'] if single_signon_services.is_a?(Hash)
|
|
90
|
+
|
|
91
|
+
single_signon_services.each do |service|
|
|
92
|
+
return service['Location'] if service['Binding'] == 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def parse_slo_url
|
|
97
|
+
return nil if entity_descriptor.dig('IDPSSODescriptor', 'SingleLogoutService').nil?
|
|
98
|
+
|
|
99
|
+
single_logout_services = entity_descriptor['IDPSSODescriptor']['SingleLogoutService']
|
|
100
|
+
|
|
101
|
+
return single_logout_services['Location'] if single_logout_services.is_a?(Hash)
|
|
102
|
+
|
|
103
|
+
single_logout_services.each do |service|
|
|
104
|
+
return service['Location'] if service['Binding'] == 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def parse_x509_certificate
|
|
109
|
+
return nil if entity_descriptor.dig('IDPSSODescriptor', 'KeyDescriptor').nil?
|
|
110
|
+
|
|
111
|
+
if entity_descriptor['IDPSSODescriptor']['KeyDescriptor'].class == Array
|
|
112
|
+
entity_descriptor['IDPSSODescriptor']['KeyDescriptor'].last['KeyInfo']['X509Data']['X509Certificate']
|
|
113
|
+
else
|
|
114
|
+
entity_descriptor['IDPSSODescriptor']['KeyDescriptor']['KeyInfo']['X509Data']['X509Certificate']
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'saml_idp_metadata/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = 'saml_idp_metadata'
|
|
9
|
+
spec.version = SamlIdpMetadata::VERSION
|
|
10
|
+
spec.authors = ['tknzk']
|
|
11
|
+
spec.email = ['tkm.knzk@gmail.com']
|
|
12
|
+
|
|
13
|
+
spec.summary = 'SAML IdP metadata.xml parser'
|
|
14
|
+
spec.description = 'SAML IdP metadata.xml parser'
|
|
15
|
+
spec.homepage = 'https://github.com/tknzk/saml_idp_metadata'
|
|
16
|
+
spec.license = 'MIT'
|
|
17
|
+
|
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
|
+
end
|
|
23
|
+
spec.bindir = 'exe'
|
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
|
+
spec.require_paths = ['lib']
|
|
26
|
+
|
|
27
|
+
spec.add_dependency 'activesupport'
|
|
28
|
+
|
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
|
30
|
+
spec.add_development_dependency 'pry'
|
|
31
|
+
spec.add_development_dependency 'rake'
|
|
32
|
+
spec.add_development_dependency 'rspec'
|
|
33
|
+
spec.add_development_dependency 'rubocop'
|
|
34
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: saml_idp_metadata
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- tknzk
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.17'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.17'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pry
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
description: SAML IdP metadata.xml parser
|
|
98
|
+
email:
|
|
99
|
+
- tkm.knzk@gmail.com
|
|
100
|
+
executables: []
|
|
101
|
+
extensions: []
|
|
102
|
+
extra_rdoc_files: []
|
|
103
|
+
files:
|
|
104
|
+
- ".circleci/config.yml"
|
|
105
|
+
- ".github/CODEOWNERS"
|
|
106
|
+
- ".github/workflows/ruby.yml"
|
|
107
|
+
- ".gitignore"
|
|
108
|
+
- ".rspec"
|
|
109
|
+
- ".rubocop.yml"
|
|
110
|
+
- ".rubocop_todo.yml"
|
|
111
|
+
- CODE_OF_CONDUCT.md
|
|
112
|
+
- Gemfile
|
|
113
|
+
- Gemfile.lock
|
|
114
|
+
- LICENSE
|
|
115
|
+
- README.md
|
|
116
|
+
- Rakefile
|
|
117
|
+
- bin/console
|
|
118
|
+
- bin/setup
|
|
119
|
+
- lib/saml_idp_metadata.rb
|
|
120
|
+
- lib/saml_idp_metadata/parser.rb
|
|
121
|
+
- lib/saml_idp_metadata/version.rb
|
|
122
|
+
- saml_idp_metadata.gemspec
|
|
123
|
+
homepage: https://github.com/tknzk/saml_idp_metadata
|
|
124
|
+
licenses:
|
|
125
|
+
- MIT
|
|
126
|
+
metadata: {}
|
|
127
|
+
post_install_message:
|
|
128
|
+
rdoc_options: []
|
|
129
|
+
require_paths:
|
|
130
|
+
- lib
|
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
|
+
requirements:
|
|
133
|
+
- - ">="
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: '0'
|
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - ">="
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: '0'
|
|
141
|
+
requirements: []
|
|
142
|
+
rubygems_version: 3.0.3
|
|
143
|
+
signing_key:
|
|
144
|
+
specification_version: 4
|
|
145
|
+
summary: SAML IdP metadata.xml parser
|
|
146
|
+
test_files: []
|