bowtie-io 1.3.2 → 1.3.3

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
  SHA1:
3
- metadata.gz: a0f2ddb9697a9fc29344655df820df45bba2d4ae
4
- data.tar.gz: 52acc84cb22015097478e94316a7af92eca78fbf
3
+ metadata.gz: c1affda45f65d974b823f4635d4d303bba3e8452
4
+ data.tar.gz: 33c66f86948db451c4dc09bb671c456329110acd
5
5
  SHA512:
6
- metadata.gz: 4b99b828c127ae94d3f76af269c3b8297fcfa47cdf6ebcc9fee840fe438a06416b6d149bb6155c2f2eaa1f63218a6b103c8311675a293f9861d535371e935c3a
7
- data.tar.gz: 7c7421982af91bd8b19b13c1e619018d198c99af70cf6a33275c4a9ed12f0da96002a904206eda3754280d7ea62674a5dc8d08c61054628c71a73dbb3994926d
6
+ metadata.gz: 1e9ad3a999dc035e7f6d8b68f15fa058a9202c15ba2683247d33b46d87e8b6fdde1c03a8c66e811a0c72af5d44a280cf371eff0b1ad59423141b59b0d79d197d
7
+ data.tar.gz: b5af4476f93e6794d9457977c6183091901e9794a6041f7197eb01a57f93d05eac1b7579b8ee241b208c8ed1ee0e710a9c768889522e02d9331d5bfcadf488af
data/lib/bowtie.rb CHANGED
@@ -7,11 +7,12 @@ require 'restclient'
7
7
 
8
8
  module Bowtie
9
9
  module Middleware
10
- autoload :Proxy , 'bowtie/middleware/proxy'
11
- autoload :Static , 'bowtie/middleware/static'
12
- autoload :Rewrite , 'bowtie/middleware/rewrite'
13
- autoload :PolicyCheck , 'bowtie/middleware/policy_check'
14
- autoload :Session , 'bowtie/middleware/session'
10
+ autoload :Proxy , 'bowtie/middleware/proxy'
11
+ autoload :Static , 'bowtie/middleware/static'
12
+ autoload :NamedActions , 'bowtie/middleware/named_actions'
13
+ autoload :Rewrite , 'bowtie/middleware/rewrite'
14
+ autoload :PolicyCheck , 'bowtie/middleware/policy_check'
15
+ autoload :Session , 'bowtie/middleware/session'
15
16
  end
16
17
 
17
18
  autoload :Settings, 'bowtie/settings'
@@ -35,6 +35,9 @@ module Bowtie
35
35
  use Rack::Session::Cookie, key: 'client.session',
36
36
  secret: '_bowtie_client_local'
37
37
 
38
+ # Redirect overrides based on local settings.json
39
+ use Bowtie::Middleware::NamedActions
40
+
38
41
  use Bowtie::Middleware::Rewrite, options
39
42
 
40
43
  # User management provided by BowTie /users/*
@@ -0,0 +1,29 @@
1
+ module Bowtie::Middleware
2
+ class NamedActions
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ status, headers, response = @app.call(env)
9
+
10
+ action = headers['X-Bowtie-Client-Named-Action']
11
+
12
+ if action == 'sign_in'
13
+ location_override_path = Bowtie::Settings['users']['after_sign_in_path'] rescue nil
14
+ elsif action == 'sign_up'
15
+ location_override_path = Bowtie::Settings['users']['after_sign_up_path'] rescue nil
16
+ elsif action == 'sign_out'
17
+ location_override_path = Bowtie::Settings['users']['after_sign_out_path'] rescue nil
18
+ end
19
+
20
+ if location_override_path
21
+ location = URI(headers['Location'])
22
+ location.path = location_override_path
23
+ headers.merge!('Location' => location.to_s)
24
+ end
25
+
26
+ [status, headers, response]
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module Bowtie
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bowtie-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Kassemi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-23 00:00:00.000000000 Z
11
+ date: 2015-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -93,6 +93,7 @@ files:
93
93
  - lib/bowtie/command.rb
94
94
  - lib/bowtie/commands/serve.rb
95
95
  - lib/bowtie/errors.rb
96
+ - lib/bowtie/middleware/named_actions.rb
96
97
  - lib/bowtie/middleware/policy_check.rb
97
98
  - lib/bowtie/middleware/proxy.rb
98
99
  - lib/bowtie/middleware/rewrite.rb