rack-oauth2 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rack/oauth2/server/authorize/error.rb +25 -6
- data/spec/rack/oauth2/server/authorize/error_spec.rb +10 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e34e57b982d446924589af2312d29073e3059ce1
|
4
|
+
data.tar.gz: f77dc85bcbceebf5c40c80a783a19279fb39c31f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e9dd064059221305eab85ef20de2f34b219c915d6cd6041c6babbfe7a5df8b842ca75e32a3ef94a62901fa6d29b7b7fec835184a8ef76473239e69ca5ebebf
|
7
|
+
data.tar.gz: 1e2758261bb2cb143971345c1b52311fec882643573a580578b9ec1e3ad8b2e4187a57c708583deef0beaa934e9cefd5c117a095ae4ca88188c59259efa3ad30
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.10
|
@@ -47,16 +47,35 @@ module Rack
|
|
47
47
|
|
48
48
|
def self.included(klass)
|
49
49
|
DEFAULT_DESCRIPTION.each do |error, default_description|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
case error
|
51
|
+
when :server_error, :temporarily_unavailable
|
52
|
+
# NOTE: defined below
|
53
|
+
else
|
54
|
+
klass.class_eval <<-ERROR
|
55
|
+
def #{error}!(description = "#{default_description}", options = {})
|
56
|
+
bad_request! :#{error}, description, options
|
57
|
+
end
|
58
|
+
ERROR
|
59
|
+
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
|
58
63
|
def bad_request!(error = :bad_request, description = nil, options = {})
|
59
|
-
|
64
|
+
error! BadRequest, error, description, options
|
65
|
+
end
|
66
|
+
|
67
|
+
def server_error!(description = DEFAULT_DESCRIPTION[:server_error], options = {})
|
68
|
+
error! ServerError, :server_error, description, options
|
69
|
+
end
|
70
|
+
|
71
|
+
def temporarily_unavailable!(description = DEFAULT_DESCRIPTION[:temporarily_unavailable], options = {})
|
72
|
+
error! TemporarilyUnavailable, :temporarily_unavailable, description, options
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def error!(klass, error, description, options)
|
78
|
+
exception = klass.new error, description, options
|
60
79
|
exception.protocol_params_location = error_params_location
|
61
80
|
exception.state = state
|
62
81
|
exception.redirect_uri = verified_redirect_uri
|
@@ -91,8 +91,17 @@ describe Rack::OAuth2::Server::Authorize::ErrorMethods do
|
|
91
91
|
|
92
92
|
Rack::OAuth2::Server::Authorize::ErrorMethods::DEFAULT_DESCRIPTION.keys.each do |error_code|
|
93
93
|
method = "#{error_code}!"
|
94
|
+
klass = case error_code
|
95
|
+
when :server_error
|
96
|
+
Rack::OAuth2::Server::Authorize::ServerError
|
97
|
+
when :temporarily_unavailable
|
98
|
+
Rack::OAuth2::Server::Authorize::TemporarilyUnavailable
|
99
|
+
else
|
100
|
+
Rack::OAuth2::Server::Authorize::BadRequest
|
101
|
+
end
|
94
102
|
describe method do
|
95
|
-
it "should raise
|
103
|
+
it "should raise #{klass} with error = :#{error_code}" do
|
104
|
+
klass =
|
96
105
|
expect { request.send method }.to raise_error(klass) { |error|
|
97
106
|
error.error.should == error_code
|
98
107
|
error.description.should == default_description[error_code]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
283
|
version: 1.3.6
|
284
284
|
requirements: []
|
285
285
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
286
|
+
rubygems_version: 2.4.5
|
287
287
|
signing_key:
|
288
288
|
specification_version: 4
|
289
289
|
summary: OAuth 2.0 Server & Client Library - Both Bearer and MAC token type are supported
|