rack-oauth2 1.9.2 → 1.9.3
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/access_token.rb +1 -0
- data/lib/rack/oauth2/access_token/bearer.rb +8 -1
- data/lib/rack/oauth2/access_token/mtls.rb +16 -0
- data/lib/rack/oauth2/client.rb +9 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 547320a1fd9f9814f0ab3e8b9ffca9ed63c9eb97cdd540a6782ad65b1904d27e
|
4
|
+
data.tar.gz: f691811b07ea68a741509de51076275f83169009cf3723fbde91718f8bcfb4ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5f2c5d853d8f17d04b7020fd0fa72edf43470eab5bb532ecb05a238956755dcafb32051629e77f9f451e38bf73a4f171e8b20d4c4f606b33b3523923d733cfc
|
7
|
+
data.tar.gz: 9a3f31dc3696817c801441267b50b6839e91588a30d7e838987356ffba4595a75a4b165e5ba5f05f43aabe4848a3550330f3bf19895ca2d0338372f914d150a9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.3
|
@@ -5,7 +5,14 @@ module Rack
|
|
5
5
|
def authenticate(request)
|
6
6
|
request.header["Authorization"] = "Bearer #{access_token}"
|
7
7
|
end
|
8
|
+
|
9
|
+
def to_mtls(attributes = {})
|
10
|
+
(required_attributes + optional_attributes).each do |key|
|
11
|
+
attributes[key] = self.send(key)
|
12
|
+
end
|
13
|
+
MTLS.new attributes
|
14
|
+
end
|
8
15
|
end
|
9
16
|
end
|
10
17
|
end
|
11
|
-
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Rack
|
2
|
+
module OAuth2
|
3
|
+
class AccessToken
|
4
|
+
class MTLS < Bearer
|
5
|
+
attr_required :private_key, :certificate
|
6
|
+
|
7
|
+
def initialize(attributes = {})
|
8
|
+
super
|
9
|
+
self.token_type = :bearer
|
10
|
+
httpclient.ssl_config.client_key = private_key
|
11
|
+
httpclient.ssl_config.client_cert = certificate
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/rack/oauth2/client.rb
CHANGED
@@ -3,7 +3,7 @@ module Rack
|
|
3
3
|
class Client
|
4
4
|
include AttrRequired, AttrOptional
|
5
5
|
attr_required :identifier
|
6
|
-
attr_optional :secret, :private_key, :redirect_uri, :scheme, :host, :port, :authorization_endpoint, :token_endpoint
|
6
|
+
attr_optional :secret, :private_key, :certificate, :redirect_uri, :scheme, :host, :port, :authorization_endpoint, :token_endpoint
|
7
7
|
|
8
8
|
def initialize(attributes = {})
|
9
9
|
(required_attributes + optional_attributes).each do |key|
|
@@ -70,6 +70,7 @@ module Rack
|
|
70
70
|
|
71
71
|
def access_token!(*args)
|
72
72
|
headers, params = {}, @grant.as_json
|
73
|
+
http_client = Rack::OAuth2.http_client
|
73
74
|
|
74
75
|
# NOTE:
|
75
76
|
# Using Array#estract_options! for backward compatibility.
|
@@ -106,6 +107,12 @@ module Rack
|
|
106
107
|
params.merge!(
|
107
108
|
client_assertion_type: URN::ClientAssertionType::SAML2_BEARER
|
108
109
|
)
|
110
|
+
when :mtls
|
111
|
+
params.merge!(
|
112
|
+
client_id: identifier
|
113
|
+
)
|
114
|
+
http_client.ssl_config.client_key = private_key
|
115
|
+
http_client.ssl_config.client_cert = certificate
|
109
116
|
else
|
110
117
|
params.merge!(
|
111
118
|
client_id: identifier,
|
@@ -113,7 +120,7 @@ module Rack
|
|
113
120
|
)
|
114
121
|
end
|
115
122
|
handle_response do
|
116
|
-
|
123
|
+
http_client.post(
|
117
124
|
absolute_uri_for(token_endpoint),
|
118
125
|
Util.compact_hash(params),
|
119
126
|
headers
|
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.9.
|
4
|
+
version: 1.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/rack/oauth2/access_token/mac/sha256_hex_verifier.rb
|
178
178
|
- lib/rack/oauth2/access_token/mac/signature.rb
|
179
179
|
- lib/rack/oauth2/access_token/mac/verifier.rb
|
180
|
+
- lib/rack/oauth2/access_token/mtls.rb
|
180
181
|
- lib/rack/oauth2/client.rb
|
181
182
|
- lib/rack/oauth2/client/error.rb
|
182
183
|
- lib/rack/oauth2/client/grant.rb
|
@@ -301,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
302
|
version: '0'
|
302
303
|
requirements: []
|
303
304
|
rubyforge_project:
|
304
|
-
rubygems_version: 2.7.
|
305
|
+
rubygems_version: 2.7.6
|
305
306
|
signing_key:
|
306
307
|
specification_version: 4
|
307
308
|
summary: OAuth 2.0 Server & Client Library - Both Bearer and MAC token type are supported
|