postmark-inbound 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe7694d0faeedc5cdd97dd2e63d330bec50b9ea6
4
- data.tar.gz: c3ec1d7e11bc8158817ae9d9370e37b632030349
3
+ metadata.gz: 034aa428798a3824eddbccfcc91f128d32d09983
4
+ data.tar.gz: 0340b574dc1ef7d314b86417e9c9a6c9f5b9d3eb
5
5
  SHA512:
6
- metadata.gz: 9c7d26a417d122ac4485ab42e07c1518ec8ea00d393905a6e97db72c00c4834f24b3f361ce6799433b5faaa3446b812dbb0af7a6519fcd99e4fd774ba761a68f
7
- data.tar.gz: a47d758e4a19c7aba0fd4159a4caf1b0c814b719f0dcc19e90cb03ce399f2b4432717ee89520ca67c9a27d0c05f6d2e970208248ede534b542cdb8dde0ec4671
6
+ metadata.gz: eb30b5de2aa8042ee269c0dd88caf501132710e63a7cbfb7e0b25adad0fdd4c33016ca67704713b85656a0980575127041899872a2497f5650added9845c1451
7
+ data.tar.gz: e7be9a60f997880660ad087ca3bb360f7c76f2b0cede8fc4acd956ac39ea78002dd24f9385e48bc38cbc6eed7e55f8eacd1c0be60b629e6c56142b4340764789
data/README.md CHANGED
@@ -30,8 +30,9 @@ PINS.logger.level = Logger::DEBUG
30
30
  PINS::Config.setup do |c|
31
31
  # User custom data
32
32
  c.user = {my_data1: 'Something', my_data2: 'Somethingelse'}
33
- # Optional: if any number of strings are set, it will require a matching "?auth=" parameter in the incoming request
34
- c.auth_tokens = [
33
+ # For security, basic auth is required.
34
+ # Set accepted passwords; username is ignored
35
+ c.passwords = [
35
36
  'someSTRING1234',
36
37
  'OTHERstring987'
37
38
  ]
@@ -26,12 +26,12 @@ module PINS
26
26
  end
27
27
 
28
28
  attr_accessor :user
29
- attr_accessor :auth_tokens
29
+ attr_accessor :passwords
30
30
  attr_accessor :dump_errors
31
31
  attr_accessor :logging
32
32
 
33
33
  def initialize
34
- @auth_tokens = []
34
+ @passwords = []
35
35
  @dump_errors = false
36
36
  @logging = false
37
37
  end
@@ -6,6 +6,10 @@ module PINS
6
6
  # The Sinatra server
7
7
  class Server < Sinatra::Base
8
8
 
9
+ use Rack::Auth::Basic, "Restricted Area" do |username, password|
10
+ Config.shared.passwords.include?(password)
11
+ end
12
+
9
13
  helpers Helper
10
14
 
11
15
  configure do
@@ -17,11 +21,6 @@ module PINS
17
21
  PINS.logger.info('Sinatra server configured.')
18
22
  end
19
23
 
20
- before do
21
- tokens = Config.shared.auth_tokens
22
- halt 401 unless tokens.empty? || tokens.include?(params[:auth])
23
- end
24
-
25
24
  post '/' do
26
25
  PINS.logger.info('Incoming request received.')
27
26
  PINS.logger.debug("Body size: #{request.content_length} bytes")
@@ -36,12 +35,6 @@ module PINS
36
35
  json_with_object({message: 'Huh, nothing here.'})
37
36
  end
38
37
 
39
- error 401 do
40
- PINS.logger.info(params[:auth] ? 'Invalid auth token provided.' : 'Missing auth token.')
41
- PINS.logger.debug("Provided auth token: #{params[:auth]}") if params[:auth]
42
- json_with_object({message: 'Oops, need a valid auth.'})
43
- end
44
-
45
38
  error do
46
39
  status 500
47
40
  err = env['sinatra.error']
@@ -1,5 +1,5 @@
1
1
  module PINS
2
2
 
3
- Version = '0.0.3'
3
+ Version = '0.1.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmark-inbound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken J.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kajiki