locked-rb 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d1a936962c0223393a99583955e69cac3f18cc732c381dca238f51c1ca72ce2
4
- data.tar.gz: 1771ea97e75d13fe632bf35a98375e0bdbc3ed2d9b2574eef9ae29d5fcac9aaf
3
+ metadata.gz: c468766b7bf778b3bf456ba923360e9f29d1d5b571f8cbf6defc9b374c516441
4
+ data.tar.gz: 7345cb67528704b8b44ff18a0f44c48673f2e5664dc0ac169a437df6549e7e3f
5
5
  SHA512:
6
- metadata.gz: 3df5d04b16da50679ebc5a0f8d435a847ad8b03afb0908f333cae35495e309372a9f8540edb54aa9497305c07746a81c9d78b1afe338143bf9613c77354a3531
7
- data.tar.gz: be335f2c1691a91748e1f38073d71f7ce9c3f92e14d47a522c930aa80a06c4cc101434a4cffaaba8e2eba858d359c5c12362c26d05ced1d082e728b40a2af643
6
+ metadata.gz: 1f7573d7bcb2a5aa50415caf9b5feecb1c9b2a03c01c724b6ae189706c01ec7e23a9b5e0524785cf2a87230a16dbf99ddc5e4373d93f0415f536f40a14bc7a9e
7
+ data.tar.gz: 929805546fd45e31a74034eaba79f6ee7a683fec8f0d4364018d8911590debdc5068627591247e726c8a986c275f7302e3ea09315fdf32d73640cebe674751f8
data/README.md CHANGED
@@ -115,7 +115,7 @@ And a possible response
115
115
  status: 200,
116
116
  data: {
117
117
  action: verify,
118
- verify_token: 'f7e11d023c78'
118
+ verify_token: 'f7e11d023c78XXX'
119
119
  }
120
120
  }
121
121
  ```
@@ -37,7 +37,6 @@
37
37
  locked/api/request/build
38
38
  locked/review
39
39
  locked/api
40
- locked/configurations/merger
41
40
  ].each(&method(:require))
42
41
 
43
42
  # main sdk module
@@ -11,11 +11,10 @@ module Locked
11
11
  Locked::Validators::Present.call(options, %i[event])
12
12
  context = Locked::Context::Merger.call(@context, options[:context])
13
13
  context = Locked::Context::Sanitizer.call(context)
14
- options_with_config = Locked::Configurations::Merger.call(options)
15
14
 
16
15
  Locked::Command.new(
17
16
  'authenticate',
18
- options_with_config.merge(context: context),
17
+ options.merge(context: context),
19
18
  :post
20
19
  )
21
20
  end
@@ -31,10 +31,9 @@ module Locked
31
31
  'CF_CONNECTING_IP'
32
32
  ].freeze
33
33
  BLACKLISTED = ['HTTP_COOKIE'].freeze
34
- CUSTOM_VERIFICATION = %i[email].freeze
35
34
 
36
35
  attr_accessor :host, :port, :request_timeout, :url_prefix, :basic_auth
37
- attr_reader :api_key, :whitelisted, :blacklisted, :failover_strategy, :custom_verification
36
+ attr_reader :api_key, :whitelisted, :blacklisted, :failover_strategy
38
37
 
39
38
  def initialize
40
39
  @formatter = Locked::HeaderFormatter.new
@@ -46,7 +45,6 @@ module Locked
46
45
  self.whitelisted = WHITELISTED
47
46
  self.blacklisted = BLACKLISTED
48
47
  self.api_key = ''
49
- self.custom_verification = []
50
48
  self.basic_auth = {}
51
49
  end
52
50
 
@@ -71,14 +69,6 @@ module Locked
71
69
  raise Locked::ConfigurationError, 'unrecognized failover strategy' if @failover_strategy.nil?
72
70
  end
73
71
 
74
- def custom_verification=(values)
75
- return @custom_verification = [] if values.empty?
76
- @custom_verification = values.each_with_object([]) do |value, array|
77
- raise Locked::ConfigurationError, 'unrecognized custom verification' unless CUSTOM_VERIFICATION.include?(value)
78
- array << value
79
- end
80
- end
81
-
82
72
  def basic_auth=(value)
83
73
  return @basic_auth = {} unless value.has_key?(:username) && value.has_key?(:password)
84
74
  @basic_auth = value
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Locked
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
@@ -144,27 +144,4 @@ describe Locked::Configuration do
144
144
  end
145
145
  end
146
146
 
147
- describe 'custom_verification' do
148
- it do
149
- expect(config.custom_verification).to be_eql([])
150
- end
151
-
152
- context 'with setter' do
153
- before do
154
- config.custom_verification = [:email]
155
- end
156
-
157
- it do
158
- expect(config.custom_verification).to be_eql([:email])
159
- end
160
- end
161
-
162
- context 'when broken' do
163
- it do
164
- expect do
165
- config.custom_verification = [:unknown]
166
- end.to raise_error(Locked::ConfigurationError)
167
- end
168
- end
169
- end
170
147
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locked-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiki Takeda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2020-02-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: locked protects your users from account compromise
14
14
  email: takeda@locked.jp
@@ -30,7 +30,6 @@ files:
30
30
  - lib/locked/commands/review.rb
31
31
  - lib/locked/commands/verify.rb
32
32
  - lib/locked/configuration.rb
33
- - lib/locked/configurations/merger.rb
34
33
  - lib/locked/context/default.rb
35
34
  - lib/locked/context/merger.rb
36
35
  - lib/locked/context/sanitizer.rb
@@ -64,7 +63,6 @@ files:
64
63
  - spec/lib/Locked/commands/review_spec.rb
65
64
  - spec/lib/Locked/commands/verify_spec.rb
66
65
  - spec/lib/Locked/configuration_spec.rb
67
- - spec/lib/Locked/configurations/merger_spec.rb
68
66
  - spec/lib/Locked/context/default_spec.rb
69
67
  - spec/lib/Locked/context/merger_spec.rb
70
68
  - spec/lib/Locked/context/sanitizer_spec.rb
@@ -108,7 +106,6 @@ specification_version: 4
108
106
  summary: locked
109
107
  test_files:
110
108
  - spec/spec_helper.rb
111
- - spec/lib/Locked/configurations/merger_spec.rb
112
109
  - spec/lib/Locked/review_spec.rb
113
110
  - spec/lib/Locked/client_spec.rb
114
111
  - spec/lib/Locked/context/default_spec.rb
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Locked
4
- module Configurations
5
- class Merger
6
- class << self
7
- def call(options)
8
- return options if Locked.config.custom_verification.empty?
9
-
10
- options.merge(custom_verification: Locked.config.custom_verification)
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Locked::Configurations::Merger do
4
- describe '.call' do
5
- context '正常系' do
6
- let(:options) do
7
- {
8
- event: '$login.success',
9
- user_id: 1234,
10
- user_ip: '1.1.1.1',
11
- user_agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
12
- email: 'example@locked.jp',
13
- callback_url: 'https://locked.jp/login/result'
14
- }
15
- end
16
-
17
- context 'configでcustom_verificationが設定されていない場合' do
18
- it '引数で投げられたoptionsが返ること' do
19
- expect(Locked::Configurations::Merger.call(options)).to eq options
20
- end
21
- end
22
-
23
- context 'configでcustom_verificationが設定されている場合' do
24
- before do
25
- Locked.config.custom_verification = [:email]
26
- end
27
-
28
- it '引数で投げられたoptionsにcustom verificationがマージされて返ること' do
29
- expect(Locked::Configurations::Merger.call(options)).to include custom_verification: [:email]
30
- end
31
- end
32
- end
33
- end
34
- end