apipie-bindings 0.5.0 → 0.6.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
  SHA256:
3
- metadata.gz: e93c13921f92db59b1bd280310cb4ace26fe6767f97671e4c895cbc7acc04c9e
4
- data.tar.gz: fa4bcb25505765dcf6e8c8664465ba068f82fa3e3709466d25b8a359b66ca75d
3
+ metadata.gz: 7a72210de6a88e0e439158f565d71b121f2f375d730924256318ebd0ae53c7f7
4
+ data.tar.gz: 8aeb8cc14f9901452ab26a408a4db348fa7babeb874eab5b097e3811d1341245
5
5
  SHA512:
6
- metadata.gz: f0e5ad7af8416017fda3a1d6bca9e95ccfbfacc6a0322c66b640975dcaa2af20dba421ea0d09274b473d101c45bdebf88f02102c828a2db6a5a189800274f3ba
7
- data.tar.gz: 1caa898dc4998246a0d0843423904f6bc4fb18a230918e841d5f84f560d3c4090ede054ad6c4de4cee4ca44ffdcff74370f95e9356460eaa1c2fb3772e45c666
6
+ metadata.gz: 31c03299a7adbc40fb3f3678160a0b132993ff065c111de6d38f8d2e22013b0ca1700ca72127098f14691c19848cc35ef9057c2024021090d8a7c6e19c7033ea
7
+ data.tar.gz: 9b729a79631b955e8d99fb2d1e1c3546add63fa582d436cd059884c8b1f7a46b08f6cb3bf333e16ad4d05ee839b1f6efb51e068b324a1f1eb10dc48448c3cf3b
data/doc/release_notes.md CHANGED
@@ -1,5 +1,8 @@
1
1
  Release notes
2
2
  =============
3
+ ### 0.6.0 (2023-02-10)
4
+ * Add basic auth external ([PR #82](https://github.com/Apipie/apipie-bindings/pull/82))
5
+
3
6
  ### 0.5.0 (2022-05-10)
4
7
  * Add support for kerberos negotiate auth ([PR #81](https://github.com/Apipie/apipie-bindings/pull/81))
5
8
 
@@ -0,0 +1,31 @@
1
+ require 'apipie_bindings/authenticators/basic_auth'
2
+
3
+ module ApipieBindings
4
+ module Authenticators
5
+ class BasicAuthExternal < BasicAuth
6
+ def initialize(user, password, authentication_url, auth_request_options = {})
7
+ super(user, password)
8
+ @authentication_url = authentication_url
9
+ @auth_request_options = auth_request_options
10
+ end
11
+
12
+ def authenticate(original_request, _args)
13
+ request = RestClient::Resource.new(
14
+ @authentication_url,
15
+ @auth_request_options.merge({ user: @user, password: @password })
16
+ )
17
+ request.get do |response, _, raw_response|
18
+ if response.code == 401
19
+ raise RestClient::Unauthorized.new(response), 'External authentication did not pass.'
20
+ end
21
+
22
+ cookie = raw_response['set-cookie'].split('; ')[0]
23
+ @auth_cookie = cookie
24
+ original_request['Cookie'] = cookie
25
+ end
26
+
27
+ original_request
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,4 +1,5 @@
1
1
  require 'apipie_bindings/authenticators/basic_auth'
2
+ require 'apipie_bindings/authenticators/basic_auth_external'
2
3
  require 'apipie_bindings/authenticators/credentials_legacy'
3
4
  require 'apipie_bindings/authenticators/oauth'
4
5
  require 'apipie_bindings/authenticators/negotiate'
@@ -1,5 +1,5 @@
1
1
  module ApipieBindings
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.5.0'
3
+ @version ||= Gem::Version.new '0.6.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bačovský
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2023-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -197,6 +197,7 @@ files:
197
197
  - lib/apipie_bindings/authenticators.rb
198
198
  - lib/apipie_bindings/authenticators/base.rb
199
199
  - lib/apipie_bindings/authenticators/basic_auth.rb
200
+ - lib/apipie_bindings/authenticators/basic_auth_external.rb
200
201
  - lib/apipie_bindings/authenticators/credentials_legacy.rb
201
202
  - lib/apipie_bindings/authenticators/negotiate.rb
202
203
  - lib/apipie_bindings/authenticators/oauth.rb
@@ -271,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
272
  - !ruby/object:Gem::Version
272
273
  version: '0'
273
274
  requirements: []
274
- rubygems_version: 3.1.2
275
+ rubygems_version: 3.1.6
275
276
  signing_key:
276
277
  specification_version: 4
277
278
  summary: The Ruby bindings for Apipie documented APIs