viisp-auth-custom 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8548b19a39976bcdaa28d19fe09f0aa2a002aecb19f2415433feb87a460e33f3
4
+ data.tar.gz: 7b9363bb752a23bcc7a98d9131cbc2ad6454b4fbc7ff1b446dc54e1a68e5d2f5
5
+ SHA512:
6
+ metadata.gz: c45552e2567a6f1e88d09ae0dac211747dbe9c94d7c5699df90ff325711782f987d77bf34b54e254444a6496d01ef2197262087dcb02c93f59b3b239eb8f06fb
7
+ data.tar.gz: c4c0d1760ddfc3f71b7d6afc1946cf1547321eac338d6dd9f13e94b293340601f61b86084b0d0d24efc953c7b0b995724929a47c01be23e44f83361186687469
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ Gemfile.lock
2
+ /.bundle/
3
+ /.yardoc
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.2
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.7.2
5
+ - 3.0.0
6
+ before_install: gem install bundler -v 2.2.15
@@ -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 laurynas.butkus@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
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in viisp-auth-custom.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Laurynas Butkus
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # VIISP::Auth
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/viisp-auth.svg)](https://badge.fury.io/rb/viisp-auth)
4
+ [![Build Status](https://travis-ci.org/laurynas/viisp-auth.svg?branch=master)](https://travis-ci.org/laurynas/viisp-auth)
5
+
6
+ Lithuanian E-Government Gateway "Elektroniniai valdžios vartai" identity service client.
7
+
8
+ VIISP identity service documentation: https://www.epaslaugos.lt/portal/content/1257
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'viisp-auth'
16
+ ```
17
+
18
+ ## Configuration
19
+
20
+ ```ruby
21
+ VIISP::Auth.configure do |c|
22
+ c.pid = '1234'
23
+ c.private_key = OpenSSL::PKey::RSA.new(File.read('your-private-key.pem'))
24
+ c.postback_url = 'https://localhost'
25
+
26
+ # optional
27
+ c.providers = %w[auth.lt.identity.card auth.lt.bank]
28
+ c.attributes = %w[lt-personal-code lt-company-code]
29
+ c.user_information = %w[firstName lastName companyName email]
30
+
31
+ # enable test mode
32
+ # (in test mode there is no need to set pid and private_key)
33
+ c.test = true
34
+ end
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ Get an authentication ticket:
40
+
41
+ ```ruby
42
+ ticket = VIISP::Auth.ticket
43
+ ```
44
+
45
+ Redirected user to authentication portal with ticket using http POST.
46
+ `VIISP::Auth.portal_endpoint` is a convenience method to get portal URL.
47
+
48
+ Redirect form for testing: https://jsfiddle.net/kmrzpqwk/
49
+
50
+ After successful authentication identity data can be fetched once.
51
+
52
+ ```ruby
53
+ identity = VIISP::Auth.identity(
54
+ ticket: ticket,
55
+ include_source_data: true,
56
+ )
57
+ ```
58
+
59
+ Identity example:
60
+
61
+ ```ruby
62
+ {
63
+ "authentication_provider" => "auth.lt.bank",
64
+ "attributes" => {
65
+ "lt-personal-code" => "XXXXXXXXXXX"
66
+ },
67
+ "user_information" => {
68
+ "firstName" => "VARDENIS",
69
+ "lastName" => "PAVARDENIS",
70
+ "companyName" => nil
71
+ },
72
+ "custom_data" => "correlation-123",
73
+ "source_data" => {
74
+ "type" => "BANKLINK",
75
+ "parameters" => {
76
+ "VK_USER" => "12345678900",
77
+ "VK_TIME" => "08:57:29"
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ ### Ticket arguments
84
+
85
+ You can pass `custom_data` and override some configuration attributes when requesting ticket.
86
+
87
+ ```ruby
88
+ ticket = VIISP::Auth.ticket(
89
+ custom_data: 'custom data',
90
+ postback_url: 'https://localhost',
91
+ providers: %w[auth.lt.identity.card auth.lt.bank],
92
+ attributes: %w[lt-personal-code lt-company-code],
93
+ user_information: %w[firstName lastName companyName email],
94
+ )
95
+ ```
96
+
97
+ ## Contributing
98
+
99
+ Bug reports and pull requests are welcome on GitHub at https://github.com/laurynas/viisp-auth. 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.
100
+
101
+ ## License
102
+
103
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
104
+
105
+ ## Code of Conduct
106
+
107
+ Everyone interacting in the VIISP::Auth project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/laurynas/viisp-auth/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
Binary file
data/certs/testKey.pem ADDED
@@ -0,0 +1,28 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCbnQjgBnAEbEqG
3
+ tgNLqrCgYKvLWf6RkIvitIjmKSrqyu3xrQCaDokKBfdqRFx1/cq1/ddn7XFlJJCJ
4
+ Y2kJ6fgeLsr/a2xKaYtaEKnger6QQBcjkmuYKAfnVgmlbxnazDtApaRu9D7ut3Cp
5
+ cCcQbGnWgxbfnn2XZYNHMNoL+JWaIWjxLgjdqT/BIcWIKv4zFbi9D/taKtbYWp9Q
6
+ gUpW0ILgi6ombTAq+y6l04BzosXoIp5Mzl1zyEdLrtw8t1zd6/ulHm1QPjFAQIJ4
7
+ x3zWz715kRSgfzh2NktGdfHdaHEWANHB9xxVRhi6nhlrYTxIQdJ5eTBO55IGIjHy
8
+ qJsA0MCbAgMBAAECggEAXDm4fdUy5Fwt2yLaVykFXzeL+YwPpMPPNAAdNpNlfRvh
9
+ 457NwYAl1cvtc4yqY7+TOUMFO/Hsh64g/1vsb9S7mV/QLYrD9mIRFcLUe1cjw6hI
10
+ TmvD2ry22nMSanqrDxKFd230Q1H8Tkxnt/PhIwmtvFWa49Mxyd1+7V1VjUy5lUuQ
11
+ c8ReVGSK5txnNL+9Qg1/qsa2XOLDVeepWbaWC2GMJ9nvjZCigFfIcYiilGC6CWMw
12
+ siOupdA7TGnNloaabgMyT/L+2/ugdcRiAeI7mO2zMV705B8FbpKsuJ+4MefYpn2a
13
+ 7FZ8UXfT93nXqfV9hoj8Ms86QOxu4bCvxBOvF+i3IQKBgQDzmrdGZDEWxuNJayOL
14
+ O5ZILBnwyMGUn/yiCffO2xq21IFpFuuRVLHg261DpsmEp14bAs/IVnVDMSbjUNoP
15
+ HJd7pk1U91DIuhIZJRqTts1AjWKi9xmbxqXlAWVgF6z7YFvBpSR/dfqnZzqALkIT
16
+ 9hVJ5dV4aEtzgEUBY9fTKhov0QKBgQCjiB1pazh01JMcyzIolspBdXD39t8tI0oL
17
+ G4ZXDh49nQwmUVRCzQR+2cu6wOxukLAy7FIwvMK+12hynWrdbYIvvHNCu+usBQue
18
+ gfZWZv4XS7/ioWcUBJ6v0QVpf1ckOs6fdcWT/pgh46quareQYQ2SJD4f6ycwp2N4
19
+ nlj2UinQqwKBgBIaHyBl9Zfhs6YTBhMknGhEjrDr2ia3NMi9wOJoObX4WJ18jIjC
20
+ KG2zJU7vp+3pmf6b2ODkO9aAYollyq5wy3juxLRZpHEmEo43yZ/MZ7gySXAeuJJw
21
+ 0ocP8X6Qg9QyNt9O7EVkePnTm+9GgLaHBNH2+EP4TBMLJxWRW8pfSI7hAoGAB3fi
22
+ 5/qWlHdU1J7PBp2EVSL46soifRw8eG9kXjtt1CCE+ocCUx6r0uM9c6T150LCWUED
23
+ q+gi+LY7tehMhhpHNMjldqnAZJXCZxXGW0HO3t99vuriGz7uxFbGaYAASc5Ju2yU
24
+ fmLFLd8I33hOM9DK3t6625hQrN8oIs0QgQdVk4sCgYBNczHEmwGknqmkF4EXFSxy
25
+ sozveJftCFgv8LrAhX0QLEPd8H8nNY8WSHCQZ4+hnvePYJnrSWxl6fM23pd9AInc
26
+ LrwLasQmdYzzPmJrKIoTjUbzxYxLYEsTzlz8068kvFiPHiIyWdB5zupKNAaGnMZN
27
+ RKOCbWATWhO58C9AqdvH0g==
28
+ -----END PRIVATE KEY-----
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module VIISP
6
+ module Auth
7
+ class Client
8
+ def post(document)
9
+ with_error_handling do
10
+ request = Signing.sign(document)
11
+ response = connection.post('', request)
12
+ xml = Nokogiri::XML(response.body)
13
+ Signing.validate!(xml)
14
+ xml
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def with_error_handling
21
+ yield
22
+ rescue Faraday::ClientError => e
23
+ raise(RequestError, "#{e.message}. #{e.response}")
24
+ end
25
+
26
+ def connection
27
+ @connection ||= Faraday.new(url: configuration.endpoint) do |builder|
28
+ builder.options[:timeout] = configuration.read_timeout
29
+ builder.options[:open_timeout] = configuration.open_timeout
30
+
31
+ builder.headers['Accept'] = 'application/xml'
32
+
33
+ builder.response :raise_error
34
+
35
+ builder.adapter Faraday.default_adapter
36
+ end
37
+ end
38
+
39
+ def configuration
40
+ VIISP::Auth.configuration
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VIISP
4
+ module Auth
5
+ class Configuration
6
+ attr_writer :pid
7
+ attr_writer :postback_url
8
+ attr_writer :private_key
9
+ attr_writer :service_cert
10
+ attr_writer :test
11
+ attr_writer :endpoint
12
+ attr_writer :portal_endpoint
13
+
14
+ attr_accessor :providers
15
+ attr_accessor :attributes
16
+ attr_accessor :user_information
17
+
18
+ attr_accessor :read_timeout
19
+ attr_accessor :open_timeout
20
+
21
+ CERTS_PATH = File.expand_path('../../../../certs', __FILE__).freeze
22
+
23
+ DEFAULT_PROVIDERS = %w[
24
+ auth.lt.identity.card
25
+ auth.lt.bank
26
+ auth.signatureProvider
27
+ auth.login.pass
28
+ auth.lt.government.employee.card
29
+ auth.stork
30
+ auth.tsl.identity.card
31
+ ].freeze
32
+
33
+ DEFAULT_ATTRIBUTES = %w[
34
+ lt-personal-code
35
+ lt-company-code
36
+ lt-government-employee-code
37
+ stork-eid
38
+ tsl-serial-number
39
+ login
40
+ ].freeze
41
+
42
+ DEFAULT_USER_INFORMATION = %w[
43
+ firstName
44
+ lastName
45
+ address
46
+ email
47
+ phoneNumber
48
+ birthday
49
+ companyName
50
+ ].freeze
51
+
52
+ PRODUCTION_ENDPOINT = 'https://www.epaslaugos.lt/portal/authenticationServices/auth'
53
+ PRODUCTION_PORTAL_ENDPOINT = 'https://www.epaslaugos.lt/portal/external/services/authentication/v2/'
54
+
55
+ TEST_PID = 'VSID000000000113'
56
+ TEST_ENDPOINT = 'https://test.epaslaugos.lt/services/services/auth'
57
+ TEST_PORTAL_ENDPOINT = 'https://test.epaslaugos.lt/portal/external/services/authentication/v2/'
58
+
59
+ DEFAULT_OPEN_TIMEOUT = 3
60
+ DEFAULT_READ_TIMEOUT = 10
61
+
62
+ def initialize
63
+ @providers = DEFAULT_PROVIDERS
64
+ @attributes = DEFAULT_ATTRIBUTES
65
+ @user_information = DEFAULT_USER_INFORMATION
66
+
67
+ @open_timeout = DEFAULT_OPEN_TIMEOUT
68
+ @read_timeout = DEFAULT_READ_TIMEOUT
69
+ end
70
+
71
+ def pid
72
+ return @pid if @pid
73
+ return TEST_PID if test?
74
+ error('pid not configured')
75
+ end
76
+
77
+ def postback_url
78
+ @postback_url || error('postback_url not configured')
79
+ end
80
+
81
+ def endpoint
82
+ return @endpoint if @endpoint
83
+ return TEST_ENDPOINT if test?
84
+ PRODUCTION_ENDPOINT
85
+ end
86
+
87
+ def portal_endpoint
88
+ return @portal_endpoint if @portal_endpoint
89
+ return TEST_PORTAL_ENDPOINT if test?
90
+ PRODUCTION_PORTAL_ENDPOINT
91
+ end
92
+
93
+ def private_key
94
+ return @private_key if @private_key
95
+ return test_private_key if test?
96
+ error('private key not configured')
97
+ end
98
+
99
+ def service_cert
100
+ @service_cert || builtin_service_cert
101
+ end
102
+
103
+ def test?
104
+ @test
105
+ end
106
+
107
+ private
108
+
109
+ def builtin_service_cert
110
+ @builtin_service_cert ||= OpenSSL::X509::Certificate.new(
111
+ read_cert('epaslaugos_ident.cer')
112
+ )
113
+ end
114
+
115
+ def test_private_key
116
+ @test_private_key ||= OpenSSL::PKey::RSA.new(
117
+ read_cert('testKey.pem')
118
+ )
119
+ end
120
+
121
+ def read_cert(filename)
122
+ path = File.join(CERTS_PATH, filename)
123
+ File.read(path)
124
+ end
125
+
126
+ def error(message)
127
+ raise(ConfigurationError, message)
128
+ end
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VIISP
4
+ module Auth
5
+ class Error < StandardError; end
6
+ class RequestError < Error; end
7
+ class SignatureError < Error; end
8
+ class ConfigurationError < Error; end
9
+ end
10
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VIISP
4
+ module Auth
5
+ class Identity
6
+ attr_reader :doc
7
+
8
+ def initialize(doc)
9
+ @doc = doc
10
+ end
11
+
12
+ def to_hash
13
+ {
14
+ 'authentication_provider' => element_text('authenticationProvider'),
15
+ 'attributes' => attributes,
16
+ 'user_information' => user_information,
17
+ 'custom_data' => element_text('customData'),
18
+ 'source_data' => source_data,
19
+ }
20
+ end
21
+
22
+ private
23
+
24
+ def attributes
25
+ pairs = doc.css('authenticationAttribute').map do |el|
26
+ [el.at('attribute').text, el.at('value').text]
27
+ end
28
+
29
+ Hash[pairs]
30
+ end
31
+
32
+ def user_information
33
+ pairs = doc.css('userInformation').map do |el|
34
+ value = el.at('stringValue')&.text || el.at('dateValue')&.text
35
+ [el.at('information').text, value]
36
+ end
37
+
38
+ Hash[pairs]
39
+ end
40
+
41
+ def source_data
42
+ return unless source_data_element
43
+
44
+ {
45
+ 'type' => source_data_element.at('type').text,
46
+ 'parameters' => source_data_parameters,
47
+ }
48
+ end
49
+
50
+ def source_data_element
51
+ @source_data_element ||= doc.at('sourceData')
52
+ end
53
+
54
+ def source_data_parameters
55
+ pairs = source_data_element.css('parameter').map do |el|
56
+ [el.attr('name'), el.text]
57
+ end
58
+
59
+ Hash[pairs]
60
+ end
61
+
62
+ def element_text(element_name)
63
+ doc.at(element_name)&.text
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VIISP
4
+ module Auth
5
+ module Requests
6
+ class Identity
7
+ include Soap
8
+ include Signature
9
+
10
+ NODE_ID = 'uniqueNodeId'
11
+
12
+ def initialize(ticket:, include_source_data: false)
13
+ @ticket = ticket
14
+ @include_source_data = include_source_data
15
+ end
16
+
17
+ def build
18
+ builder = Nokogiri::XML::Builder.new do |builder|
19
+ soap_envelope(builder) do
20
+ build_request(builder)
21
+ end
22
+ end
23
+
24
+ builder.doc
25
+ end
26
+
27
+ private
28
+
29
+ def build_request(builder)
30
+ builder[:authentication].authenticationDataRequest(id: NODE_ID) do
31
+ builder.pid(configuration.pid)
32
+ builder.ticket(@ticket)
33
+ builder.includeSourceData('true') if @include_source_data
34
+
35
+ build_signature(builder, NODE_ID)
36
+ end
37
+ end
38
+
39
+ def configuration
40
+ Auth.configuration
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VIISP
4
+ module Auth
5
+ module Requests
6
+ module Signature
7
+ def build_signature(builder, element_id)
8
+ builder[:ds].Signature do
9
+ builder.SignedInfo do
10
+ builder.CanonicalizationMethod(Algorithm: 'http://www.w3.org/2001/10/xml-exc-c14n#')
11
+ builder.SignatureMethod(Algorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256')
12
+ builder.Reference(URI: '#' + element_id) do
13
+ builder.Transforms do
14
+ builder.Transform(Algorithm: 'http://www.w3.org/2000/09/xmldsig#enveloped-signature')
15
+ end
16
+ builder.DigestMethod(Algorithm: 'http://www.w3.org/2001/04/xmlenc#sha256')
17
+ builder.DigestValue
18
+ end
19
+ end
20
+ builder.SignatureValue
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VIISP
4
+ module Auth
5
+ module Requests
6
+ module Soap
7
+ NAMESPACES = {
8
+ 'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/',
9
+ 'xmlns:authentication' => 'http://www.epaslaugos.lt/services/authentication',
10
+ 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
11
+ }.freeze
12
+
13
+ def soap_envelope(builder)
14
+ builder[:soapenv].Envelope(NAMESPACES) do
15
+ builder.Body { yield }
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end