pakyow-routing 1.0.0.rc5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -135
- data/lib/pakyow/application/actions/routing/respond_missing.rb +15 -0
- data/lib/pakyow/application/behavior/routing/definition.rb +39 -0
- data/lib/pakyow/routing.rb +1 -1
- data/lib/pakyow/routing/controller.rb +22 -22
- data/lib/pakyow/routing/controller/behavior/error_handling.rb +2 -2
- data/lib/pakyow/routing/framework.rb +4 -4
- data/lib/pakyow/security/config.rb +32 -0
- metadata +13 -14
- data/lib/pakyow/actions/routing/respond_missing.rb +0 -13
- data/lib/pakyow/behavior/definition.rb +0 -35
- data/lib/pakyow/security/behavior/config.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3f6e7c251e82bca0e829a9222faa6f751ddcd7e748c35935dcb64f37a4d9eb
|
4
|
+
data.tar.gz: 05d7fe921a18fa1a0ec22a65edbdf084be0a4d81fa46b9b4993e20ae5bd39af2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e386d5abefc690f41335c31dc724519c15c8948853ed52024b5a4a151c4d7d9d0a79c8e1c406cd92e20546a72c5cd34543ffb5e5dfd1ed640ab165953b0ef23b
|
7
|
+
data.tar.gz: 7e20a0bc29f4d9899dcec03133613f3e63048b5d7af4f700ea0f0195335d7ffa966ee433eff710850c6769fb6d92e542afc43f4ba2d2bee7a4b3e0b13b27da57
|
data/CHANGELOG.md
CHANGED
@@ -1,137 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# UNRELEASED
|
2
2
|
|
3
|
-
|
4
|
-
`Helpers` is included only into `CallContext`. Extensions to `App` is now
|
5
|
-
considered an edge-case and should be done through other normal means.
|
6
|
-
* IMPROVED hooks by removing `Helpers::Hooks` in favor of `Support::Hookable`.
|
7
|
-
* ADDED verbose log level.
|
8
|
-
* CHANGED default production log level to `info`.
|
3
|
+
# 1.0
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
* Adds the ability to `send` StringIO objects
|
13
|
-
|
14
|
-
# 0.11.1
|
15
|
-
|
16
|
-
* Includes `Pakyow::Helpers` into `Pakyow::App`
|
17
|
-
|
18
|
-
# 0.11.0
|
19
|
-
|
20
|
-
* Adds a `configure` hook for evaluating code before/after configuring app
|
21
|
-
* The `Pakyow::App.define` method now returns the defined app
|
22
|
-
* Explicitly requires `pakyow-support` so core works on its own
|
23
|
-
* Adds a convenience method for defining a restful resource
|
24
|
-
* Adds a `reload` hook for evaluating code before/after reloading app
|
25
|
-
* Better support for sending any IO object or String data
|
26
|
-
* Defaults to `global` when defining app configuration
|
27
|
-
* Adds a new `reloader` config namespace
|
28
|
-
* Redirects requests with `//` to single-slash path
|
29
|
-
* Adds the ability to easily disable middleware
|
30
|
-
* Bundles and configures middleware for session handling
|
31
|
-
* Automatically removes the trailing `/` in request path
|
32
|
-
* Now loads the global config options before env-specific options
|
33
|
-
* Adds the source directory to the load path
|
34
|
-
* Sets default Content-Type to utf-8
|
35
|
-
* Moves everything into the Pakyow namespace
|
36
|
-
* Changes to allow error hooks to halt execution
|
37
|
-
* Adds a convenience method for checking the existence of a route
|
38
|
-
* Protects against internal failures when calling a route with an unknown method
|
39
|
-
* Fixes route hook execution order, prioritizing hooks defined in outer scopes
|
40
|
-
|
41
|
-
# 0.10.2 / 2015-11-15
|
42
|
-
|
43
|
-
* Fixes issues presenting error views from gem
|
44
|
-
* Fixes a bug causing routes to inherit hooks from previously defined routes
|
45
|
-
* No longer resets the working context when redirecting or sending a file
|
46
|
-
* Uses Rack's delete_cookie method rather than unset_cookie
|
47
|
-
|
48
|
-
# 0.10.0 / 2015-10-19
|
49
|
-
|
50
|
-
* Adds nested route groups / namespaces inherit hooks
|
51
|
-
* Static files are now served by default
|
52
|
-
* Consistently handles externally defined config options
|
53
|
-
* Adds post-processing step to route template expansions
|
54
|
-
* Prevents the logger from breaking when no log to write to
|
55
|
-
* Prevents resouces config from being reset on access
|
56
|
-
* Don't add query params when route building
|
57
|
-
* Fixes bug when defining nested restful routes
|
58
|
-
* Support passing group + route name to `redir` and `reroute`
|
59
|
-
* Updated status code names
|
60
|
-
* Sets mime type of response when setting type
|
61
|
-
* Exposes content type on response object
|
62
|
-
* Adds support for `pakyow.data` in Rack env
|
63
|
-
* Runs global config *after* local config
|
64
|
-
* Makes JSON body available in request params
|
65
|
-
* Fixes a bug in app reloading
|
66
|
-
* Ported all tests to rspec
|
67
|
-
* Adds the ability to halt execution in a 500 handler
|
68
|
-
* Fixes namespace collisions
|
69
|
-
* Use app's template for displaying Pakyow error views
|
70
|
-
* Provides default values for helpers when no context available
|
71
|
-
* Use `Bundler.require` to load dependencies in global config block
|
72
|
-
* Respects before hook order
|
73
|
-
* No longer overrides user-provided type when sending data/files
|
74
|
-
|
75
|
-
# 0.9.1 / 2014-12-06
|
76
|
-
|
77
|
-
* No changes -- bumped version to be consistent
|
78
|
-
|
79
|
-
# 0.9.0 / 2014-11-09
|
80
|
-
|
81
|
-
* Renames restful "remove" action to "delete"
|
82
|
-
* Improves app generator bundle install by showing progress
|
83
|
-
* Complete refactor of config handling with a shiny DSL
|
84
|
-
* Includes pakyow-rake as a dependency, and updates the generated Rakefile
|
85
|
-
* Removes support for Ruby versions < 2.0.0
|
86
|
-
|
87
|
-
# 0.8.0 / 2014-03-02
|
88
|
-
|
89
|
-
* Major rewrite, including changes to app definition and routing
|
90
|
-
|
91
|
-
# 0.7.2 / 2012-02-29
|
92
|
-
|
93
|
-
* Application server shuts down gracefully
|
94
|
-
* Fix issue requesting route with format
|
95
|
-
* Fix issue surrounding ignore_routes -- now matches request path in all cases
|
96
|
-
|
97
|
-
# 0.7.1 / 2012-01-08
|
98
|
-
|
99
|
-
* Changed loader to only load ruby files
|
100
|
-
* Moved session from app to request
|
101
|
-
* Replaced autoload with require
|
102
|
-
* Fixed generated rackup to use builder
|
103
|
-
* Fixed generated rakefile so it runs in a specific environment
|
104
|
-
* Fixed issue running with ignore_routes turned on
|
105
|
-
|
106
|
-
# 0.7.0 / 2011-11-19
|
107
|
-
|
108
|
-
* Added middleware for logging, static, and reloading
|
109
|
-
* Added invoke_route! and invoke_handler! methods
|
110
|
-
* Added before, after, and around hooks to routes
|
111
|
-
* Added pakyow console
|
112
|
-
* Changed methods that modify request/response life cycle to bang methods
|
113
|
-
* Fixed regex route error (was removing route vars)
|
114
|
-
* App file is no longer loaded twice upon initialization
|
115
|
-
* Fix cookie creation when cookie is a non-nil value but not a String
|
116
|
-
|
117
|
-
# 0.6.3 / 2011-09-13
|
118
|
-
|
119
|
-
* Fixes several load path issues
|
120
|
-
* Fixes gemspecs so gem can be built/used from anywhere
|
121
|
-
* Fixes inconsistency with with request.params having string and symbol keys
|
122
|
-
* Fixes loading of middleware when staging application (simplifies rackup)
|
123
|
-
|
124
|
-
# 0.6.2 / 2011-08-20
|
125
|
-
|
126
|
-
* Fixes issue running pakyow server on Windows
|
127
|
-
* Fixes several issues related to error handlers
|
128
|
-
* Fixes an issue when using alphanumeric ids in restful routes
|
129
|
-
* JRuby Support
|
130
|
-
|
131
|
-
# 0.6.1 / 2011-08-20
|
132
|
-
|
133
|
-
* Fixes gemspec problem
|
134
|
-
|
135
|
-
# 0.6.0 / 2011-08-20
|
136
|
-
|
137
|
-
* Initial gem release of 0.6.0 codebase
|
5
|
+
* Hello, Web
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pakyow
|
4
|
+
class Application
|
5
|
+
module Actions
|
6
|
+
module Routing
|
7
|
+
class RespondMissing
|
8
|
+
def call(connection)
|
9
|
+
connection.app.controller_for_connection(connection).trigger(404)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pakyow/support/extension"
|
4
|
+
|
5
|
+
module Pakyow
|
6
|
+
class Application
|
7
|
+
module Behavior
|
8
|
+
module Routing
|
9
|
+
module Definition
|
10
|
+
extend Support::Extension
|
11
|
+
|
12
|
+
apply_extension do
|
13
|
+
include Methods
|
14
|
+
extend Methods
|
15
|
+
end
|
16
|
+
|
17
|
+
module Methods
|
18
|
+
# Defines a RESTful resource.
|
19
|
+
#
|
20
|
+
# @see Routing::Extension::Resource
|
21
|
+
#
|
22
|
+
def resource(name, path, *args, param: Pakyow::Routing::Extension::Resource::DEFAULT_PARAM, &block)
|
23
|
+
controller name, path, *args do
|
24
|
+
expand_within(:resource, param: param, &block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Registers an error handler automatically available in all Controller instances.
|
29
|
+
#
|
30
|
+
# @see Routing::Behavior::ErrorHandling#handle
|
31
|
+
def handle(name_exception_or_code, as: nil, &block)
|
32
|
+
const_get(:Controller).handle(name_exception_or_code, as: as, &block)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/pakyow/routing.rb
CHANGED
@@ -22,7 +22,7 @@ module Pakyow
|
|
22
22
|
module Routing
|
23
23
|
# Executes code for particular requests. For example:
|
24
24
|
#
|
25
|
-
# Pakyow::
|
25
|
+
# Pakyow::Application.controller do
|
26
26
|
# get "/" do
|
27
27
|
# # called for GET / requests
|
28
28
|
# end
|
@@ -32,7 +32,7 @@ module Pakyow
|
|
32
32
|
# context of its controller. This means that any method defined in a controller is available to be
|
33
33
|
# called from within a route. For example:
|
34
34
|
#
|
35
|
-
# Pakyow::
|
35
|
+
# Pakyow::Application.controller do
|
36
36
|
# def foo
|
37
37
|
# end
|
38
38
|
#
|
@@ -48,7 +48,7 @@ module Pakyow
|
|
48
48
|
# end
|
49
49
|
# end
|
50
50
|
#
|
51
|
-
# Pakyow::
|
51
|
+
# Pakyow::Application.controller do
|
52
52
|
# include AuthHelpers
|
53
53
|
#
|
54
54
|
# get :foo, "/foo" do
|
@@ -56,7 +56,7 @@ module Pakyow
|
|
56
56
|
# end
|
57
57
|
# end
|
58
58
|
#
|
59
|
-
# See {
|
59
|
+
# See {Application.controller} for more details on defining controllers.
|
60
60
|
#
|
61
61
|
# = Supported HTTP methods
|
62
62
|
#
|
@@ -78,7 +78,7 @@ module Pakyow
|
|
78
78
|
#
|
79
79
|
# Methods can be defined as additional actions for a route. For example:
|
80
80
|
#
|
81
|
-
# Pakyow::
|
81
|
+
# Pakyow::Application.controller do
|
82
82
|
# action :called_before
|
83
83
|
#
|
84
84
|
# def called_before
|
@@ -110,7 +110,7 @@ module Pakyow
|
|
110
110
|
# end
|
111
111
|
# end
|
112
112
|
#
|
113
|
-
# Pakyow::
|
113
|
+
# Pakyow::Application.controller << FooController
|
114
114
|
#
|
115
115
|
# = Custom matchers
|
116
116
|
#
|
@@ -123,7 +123,7 @@ module Pakyow
|
|
123
123
|
# end
|
124
124
|
# end
|
125
125
|
#
|
126
|
-
# Pakyow::
|
126
|
+
# Pakyow::Application.controller CustomMatcher.new do
|
127
127
|
# end
|
128
128
|
#
|
129
129
|
# Custom matchers can also make data available in +params+ by implementing +match+ and returning
|
@@ -143,7 +143,7 @@ module Pakyow
|
|
143
143
|
# end
|
144
144
|
# end
|
145
145
|
#
|
146
|
-
# Pakyow::
|
146
|
+
# Pakyow::Application.controller CustomMatcher.new do
|
147
147
|
# end
|
148
148
|
#
|
149
149
|
class Controller
|
@@ -295,21 +295,21 @@ module Pakyow
|
|
295
295
|
# @param trusted [Boolean] whether or not the location is trusted
|
296
296
|
#
|
297
297
|
# @example Redirecting:
|
298
|
-
# Pakyow::
|
298
|
+
# Pakyow::Application.controller do
|
299
299
|
# default do
|
300
300
|
# redirect "/foo"
|
301
301
|
# end
|
302
302
|
# end
|
303
303
|
#
|
304
304
|
# @example Redirecting with a status code:
|
305
|
-
# Pakyow::
|
305
|
+
# Pakyow::Application.controller do
|
306
306
|
# default do
|
307
307
|
# redirect "/foo", as: 301
|
308
308
|
# end
|
309
309
|
# end
|
310
310
|
#
|
311
311
|
# @example Redirecting to a remote location:
|
312
|
-
# Pakyow::
|
312
|
+
# Pakyow::Application.controller do
|
313
313
|
# default do
|
314
314
|
# redirect "http://foo.com/bar", trusted: true
|
315
315
|
# end
|
@@ -341,7 +341,7 @@ module Pakyow
|
|
341
341
|
# @param method [Symbol] the http method to reroute as
|
342
342
|
#
|
343
343
|
# @example
|
344
|
-
# Pakyow::
|
344
|
+
# Pakyow::Application.resource :posts, "/posts" do
|
345
345
|
# edit do
|
346
346
|
# @post ||= find_post_by_id(params[:post_id])
|
347
347
|
#
|
@@ -384,7 +384,7 @@ module Pakyow
|
|
384
384
|
# After yielding, request processing will be halted.
|
385
385
|
#
|
386
386
|
# @example
|
387
|
-
# Pakyow::
|
387
|
+
# Pakyow::Application.controller do
|
388
388
|
# get "/foo.txt|html" do
|
389
389
|
# respond_to :txt do
|
390
390
|
# send "foo"
|
@@ -412,14 +412,14 @@ module Pakyow
|
|
412
412
|
# disposition will be set to "inline".
|
413
413
|
#
|
414
414
|
# @example Sending data:
|
415
|
-
# Pakyow::
|
415
|
+
# Pakyow::Application.controller do
|
416
416
|
# default do
|
417
417
|
# send "foo", type: "text/plain"
|
418
418
|
# end
|
419
419
|
# end
|
420
420
|
#
|
421
421
|
# @example Sending a file:
|
422
|
-
# Pakyow::
|
422
|
+
# Pakyow::Application.controller do
|
423
423
|
# default do
|
424
424
|
# filename = "foo.txt"
|
425
425
|
# send File.open(filename), name: filename
|
@@ -541,7 +541,7 @@ module Pakyow
|
|
541
541
|
# @!method get
|
542
542
|
# Create a route that matches +GET+ requests at +path+. For example:
|
543
543
|
#
|
544
|
-
# Pakyow::
|
544
|
+
# Pakyow::Application.controller do
|
545
545
|
# get "/foo" do
|
546
546
|
# # do something
|
547
547
|
# end
|
@@ -550,7 +550,7 @@ module Pakyow
|
|
550
550
|
# Routes can be named, making them available for path building via {Controller#path}. For
|
551
551
|
# example:
|
552
552
|
#
|
553
|
-
# Pakyow::
|
553
|
+
# Pakyow::Application.controller do
|
554
554
|
# get :foo, "/foo" do
|
555
555
|
# # do something
|
556
556
|
# end
|
@@ -588,7 +588,7 @@ module Pakyow
|
|
588
588
|
# groups are referenced by the most direct parent group that is named.
|
589
589
|
#
|
590
590
|
# @example Defining a group:
|
591
|
-
# Pakyow::
|
591
|
+
# Pakyow::Application.controller do
|
592
592
|
#
|
593
593
|
# def foo
|
594
594
|
# logger.info "foo"
|
@@ -637,7 +637,7 @@ module Pakyow
|
|
637
637
|
# behaves just like a group with regard to path lookup and action inheritance.
|
638
638
|
#
|
639
639
|
# @example Defining a namespace:
|
640
|
-
# Pakyow::
|
640
|
+
# Pakyow::Application.controller do
|
641
641
|
# namespace :api, "/api" do
|
642
642
|
# def auth
|
643
643
|
# handle 401 unless authed?
|
@@ -669,7 +669,7 @@ module Pakyow
|
|
669
669
|
# Pakyow itself to define the resource template ({Routing::Extension::Resource}).
|
670
670
|
#
|
671
671
|
# @example Defining a template:
|
672
|
-
# Pakyow::
|
672
|
+
# Pakyow::Application.controller do
|
673
673
|
# template :talkback do
|
674
674
|
# get :hello, "/hello"
|
675
675
|
# get :goodbye, "/goodbye"
|
@@ -678,7 +678,7 @@ module Pakyow
|
|
678
678
|
#
|
679
679
|
# @example Expanding a template:
|
680
680
|
#
|
681
|
-
# Pakyow::
|
681
|
+
# Pakyow::Application.controller do
|
682
682
|
# talkback :en, "/en" do
|
683
683
|
# hello do
|
684
684
|
# send "hello"
|
@@ -720,7 +720,7 @@ module Pakyow
|
|
720
720
|
# Attempts to find and expand a template, avoiding the need to call {expand} explicitly. For
|
721
721
|
# example, these calls are identical:
|
722
722
|
#
|
723
|
-
# Pakyow::
|
723
|
+
# Pakyow::Application.controller do
|
724
724
|
# resource :posts, "/posts" do
|
725
725
|
# end
|
726
726
|
#
|
@@ -85,7 +85,7 @@ module Pakyow
|
|
85
85
|
# Registers an error handler used within a controller or request lifecycle.
|
86
86
|
#
|
87
87
|
# @example Defining for a controller:
|
88
|
-
# Pakyow::
|
88
|
+
# Pakyow::Application.controller do
|
89
89
|
# handle 500 do
|
90
90
|
# # build and send a response for `request.error`
|
91
91
|
# end
|
@@ -96,7 +96,7 @@ module Pakyow
|
|
96
96
|
# end
|
97
97
|
#
|
98
98
|
# @example Defining for a request lifecycle:
|
99
|
-
# Pakyow::
|
99
|
+
# Pakyow::Application.controller do
|
100
100
|
# default do
|
101
101
|
# handle 500 do
|
102
102
|
# # build and send a response for `request.error`
|
@@ -6,9 +6,9 @@ require "pakyow/routing/controller"
|
|
6
6
|
require "pakyow/routing/extensions"
|
7
7
|
require "pakyow/routing/helpers/exposures"
|
8
8
|
|
9
|
-
require "pakyow/behavior/definition"
|
9
|
+
require "pakyow/application/behavior/routing/definition"
|
10
10
|
|
11
|
-
require "pakyow/security/
|
11
|
+
require "pakyow/security/config"
|
12
12
|
require "pakyow/security/behavior/disabling"
|
13
13
|
require "pakyow/security/behavior/helpers"
|
14
14
|
require "pakyow/security/behavior/insecure"
|
@@ -19,7 +19,7 @@ module Pakyow
|
|
19
19
|
class Framework < Pakyow::Framework(:routing)
|
20
20
|
def boot
|
21
21
|
object.class_eval do
|
22
|
-
include Pakyow::Behavior::Definition
|
22
|
+
include Pakyow::Application::Behavior::Routing::Definition
|
23
23
|
|
24
24
|
isolate Controller do
|
25
25
|
include Extension::Resource
|
@@ -70,7 +70,7 @@ module Pakyow
|
|
70
70
|
require "pakyow/support/message_verifier"
|
71
71
|
handle Support::MessageVerifier::TamperedMessage, as: :forbidden
|
72
72
|
|
73
|
-
include Security::
|
73
|
+
include Security::Config
|
74
74
|
include Security::Behavior::Disabling
|
75
75
|
include Security::Behavior::Helpers
|
76
76
|
include Security::Behavior::Insecure
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pakyow/support/extension"
|
4
|
+
|
5
|
+
module Pakyow
|
6
|
+
module Security
|
7
|
+
module Config
|
8
|
+
extend Support::Extension
|
9
|
+
|
10
|
+
apply_extension do
|
11
|
+
configurable :security do
|
12
|
+
configurable :csrf do
|
13
|
+
setting :protection, {}
|
14
|
+
setting :origin_whitelist, []
|
15
|
+
setting :param, :"pw-authenticity-token"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require "pakyow/security/csrf/verify_same_origin"
|
20
|
+
require "pakyow/security/csrf/verify_authenticity_token"
|
21
|
+
|
22
|
+
config.security.csrf.protection = {
|
23
|
+
origin: CSRF::VerifySameOrigin.new(
|
24
|
+
origin_whitelist: config.security.csrf.origin_whitelist
|
25
|
+
),
|
26
|
+
|
27
|
+
authenticity: CSRF::VerifyAuthenticityToken.new({}),
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pakyow-routing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
|
-
- Bret Young
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: pakyow-core
|
@@ -17,30 +16,30 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - '='
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.0
|
19
|
+
version: 1.0.0
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - '='
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.0
|
26
|
+
version: 1.0.0
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
28
|
name: pakyow-support
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - '='
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.0.0
|
33
|
+
version: 1.0.0
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - '='
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.0.0
|
40
|
+
version: 1.0.0
|
42
41
|
description: Routing functionality for Pakyow
|
43
|
-
email: bryan@
|
42
|
+
email: bryan@bryanp.org
|
44
43
|
executables: []
|
45
44
|
extensions: []
|
46
45
|
extra_rdoc_files: []
|
@@ -48,8 +47,8 @@ files:
|
|
48
47
|
- CHANGELOG.md
|
49
48
|
- LICENSE
|
50
49
|
- README.md
|
51
|
-
- lib/pakyow/actions/routing/respond_missing.rb
|
52
|
-
- lib/pakyow/behavior/definition.rb
|
50
|
+
- lib/pakyow/application/actions/routing/respond_missing.rb
|
51
|
+
- lib/pakyow/application/behavior/routing/definition.rb
|
53
52
|
- lib/pakyow/routing.rb
|
54
53
|
- lib/pakyow/routing/controller.rb
|
55
54
|
- lib/pakyow/routing/controller/behavior/error_handling.rb
|
@@ -61,17 +60,17 @@ files:
|
|
61
60
|
- lib/pakyow/routing/helpers/exposures.rb
|
62
61
|
- lib/pakyow/routing/route.rb
|
63
62
|
- lib/pakyow/security/base.rb
|
64
|
-
- lib/pakyow/security/behavior/config.rb
|
65
63
|
- lib/pakyow/security/behavior/disabling.rb
|
66
64
|
- lib/pakyow/security/behavior/helpers.rb
|
67
65
|
- lib/pakyow/security/behavior/insecure.rb
|
68
66
|
- lib/pakyow/security/behavior/pipeline.rb
|
67
|
+
- lib/pakyow/security/config.rb
|
69
68
|
- lib/pakyow/security/csrf/verify_authenticity_token.rb
|
70
69
|
- lib/pakyow/security/csrf/verify_same_origin.rb
|
71
70
|
- lib/pakyow/security/errors.rb
|
72
71
|
- lib/pakyow/security/helpers/csrf.rb
|
73
72
|
- lib/pakyow/security/pipelines/csrf.rb
|
74
|
-
homepage: https://pakyow.
|
73
|
+
homepage: https://pakyow.com
|
75
74
|
licenses:
|
76
75
|
- LGPL-3.0
|
77
76
|
metadata: {}
|
@@ -86,9 +85,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
85
|
version: 2.5.0
|
87
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
87
|
requirements:
|
89
|
-
- - "
|
88
|
+
- - ">="
|
90
89
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
90
|
+
version: '0'
|
92
91
|
requirements: []
|
93
92
|
rubygems_version: 3.0.3
|
94
93
|
signing_key:
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "pakyow/support/extension"
|
4
|
-
|
5
|
-
module Pakyow
|
6
|
-
module Behavior
|
7
|
-
module Definition
|
8
|
-
extend Support::Extension
|
9
|
-
|
10
|
-
apply_extension do
|
11
|
-
include Methods
|
12
|
-
extend Methods
|
13
|
-
end
|
14
|
-
|
15
|
-
module Methods
|
16
|
-
# Defines a RESTful resource.
|
17
|
-
#
|
18
|
-
# @see Routing::Extension::Resource
|
19
|
-
#
|
20
|
-
def resource(name, path, *args, param: Pakyow::Routing::Extension::Resource::DEFAULT_PARAM, &block)
|
21
|
-
controller name, path, *args do
|
22
|
-
expand_within(:resource, param: param, &block)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Registers an error handler automatically available in all Controller instances.
|
27
|
-
#
|
28
|
-
# @see Routing::Behavior::ErrorHandling#handle
|
29
|
-
def handle(name_exception_or_code, as: nil, &block)
|
30
|
-
const_get(:Controller).handle(name_exception_or_code, as: as, &block)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "pakyow/support/extension"
|
4
|
-
|
5
|
-
module Pakyow
|
6
|
-
module Security
|
7
|
-
module Behavior
|
8
|
-
module Config
|
9
|
-
extend Support::Extension
|
10
|
-
|
11
|
-
apply_extension do
|
12
|
-
configurable :security do
|
13
|
-
configurable :csrf do
|
14
|
-
setting :protection, {}
|
15
|
-
setting :origin_whitelist, []
|
16
|
-
setting :param, :"pw-authenticity-token"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
require "pakyow/security/csrf/verify_same_origin"
|
21
|
-
require "pakyow/security/csrf/verify_authenticity_token"
|
22
|
-
|
23
|
-
config.security.csrf.protection = {
|
24
|
-
origin: CSRF::VerifySameOrigin.new(
|
25
|
-
origin_whitelist: config.security.csrf.origin_whitelist
|
26
|
-
),
|
27
|
-
|
28
|
-
authenticity: CSRF::VerifyAuthenticityToken.new({}),
|
29
|
-
}
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|