conjur-api 5.4.0.pre.404 → 5.4.0
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/features/authn.feature +2 -13
- data/features/step_definitions/api_steps.rb +2 -12
- data/lib/conjur/api/authn.rb +1 -13
- data/spec/api/host_factories_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0e6e603e128d52fb7d219106d9d9f2a4c302ea3a6ccd943fe424443f5640ff8
|
4
|
+
data.tar.gz: 4c788058b9ce44f5d044ea2635927cbfe31c6739901f514f5d796844bcb26b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c516e5fcdefb9878d33e67addfee81b168721e4e861a8d0eabd25d6452943a35ccd6f0eb0f9701407710de2d8a4919e5259de2590d9ec009c2a6d798e54486e
|
7
|
+
data.tar.gz: 59166c9503087a5f9a81af241efd81c1151d5204aea33aa87bc61aecb003ca81169efac2a4c5ceb29d6d846be4e8d587574095e71277ef889e27a7e215cb90d4
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.4.0
|
1
|
+
5.4.0
|
data/features/authn.feature
CHANGED
@@ -3,8 +3,8 @@ Feature: Authenticate with Conjur
|
|
3
3
|
Background:
|
4
4
|
Given I setup a keycloak authenticator
|
5
5
|
|
6
|
-
Scenario: Authenticate with OIDC code
|
7
|
-
When I retrieve the
|
6
|
+
Scenario: Authenticate with OIDC state and code
|
7
|
+
When I retrieve the login url for OIDC authenticator "keycloak"
|
8
8
|
And I retrieve auth info for the OIDC provider with username: "alice" and password: "alice"
|
9
9
|
And I run the code:
|
10
10
|
"""
|
@@ -12,14 +12,3 @@ Feature: Authenticate with Conjur
|
|
12
12
|
Conjur::API.authenticator_authenticate("authn-oidc", "keycloak", options: @auth_body)
|
13
13
|
"""
|
14
14
|
Then the JSON should have "payload"
|
15
|
-
|
16
|
-
Scenario: Authenticate with OIDC code requesting unparsed result
|
17
|
-
When I retrieve the provider details for OIDC authenticator "keycloak"
|
18
|
-
And I retrieve auth info for the OIDC provider with username: "alice" and password: "alice"
|
19
|
-
And I run the code:
|
20
|
-
"""
|
21
|
-
$conjur.authenticator_enable "authn-oidc", "keycloak"
|
22
|
-
Conjur::API.authenticator_authenticate_get("authn-oidc", "keycloak", options: @auth_body)
|
23
|
-
"""
|
24
|
-
Then the response body contains: "payload"
|
25
|
-
And the response includes headers
|
@@ -17,11 +17,9 @@ Then(/^this code should fail with "([^"]*)"$/) do |error_msg, code|
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
Given(/^I retrieve the
|
20
|
+
Given(/^I retrieve the login url for OIDC authenticator "([^"]+)"$/) do |service_id|
|
21
21
|
provider = $conjur.authentication_providers("authn-oidc").select {|provider_details| provider_details["service_id"] == service_id}
|
22
22
|
@login_url = provider[0]["redirect_uri"]
|
23
|
-
@nonce = provider[0]["nonce"]
|
24
|
-
@code_verifier = provider[0]["code_verifier"]
|
25
23
|
puts @login_url
|
26
24
|
end
|
27
25
|
|
@@ -49,14 +47,6 @@ Given(/^I retrieve auth info for the OIDC provider with username: "([^"]+)" and
|
|
49
47
|
|
50
48
|
if response.is_a?(Net::HTTPRedirection)
|
51
49
|
response_details = URI.decode_www_form(URI(response['location']).query)
|
52
|
-
@auth_body = {
|
50
|
+
@auth_body = {state: response_details.assoc('state')[1], code: response_details.assoc('code')[1]}
|
53
51
|
end
|
54
52
|
end
|
55
|
-
|
56
|
-
Then(/^the response body contains: "([^"]+)"$/) do |element|
|
57
|
-
expect(@result).to include(element)
|
58
|
-
end
|
59
|
-
|
60
|
-
Then(/^the response includes headers$/) do
|
61
|
-
expect(@result.headers).not_to be_empty
|
62
|
-
end
|
data/lib/conjur/api/authn.rb
CHANGED
@@ -63,22 +63,10 @@ module Conjur
|
|
63
63
|
# @param [Hash] params Additional params to send to authenticator
|
64
64
|
# @return [String] A JSON formatted authentication token.
|
65
65
|
def authenticator_authenticate authenticator, service_id, account: Conjur.configuration.account, options: {}
|
66
|
-
JSON.parse authenticator_authenticate_get authenticator, service_id, account: account, options: options
|
67
|
-
end
|
68
|
-
|
69
|
-
# Authenticates using a third party authenticator like authn-oidc via GET request.
|
70
|
-
# It will return an response object containing access/refresh token data.
|
71
|
-
#
|
72
|
-
# @param [String] authenticator
|
73
|
-
# @param [String] service_id
|
74
|
-
# @param [String] account The organization account.
|
75
|
-
# @param [Hash] params Additional params to send to authenticator
|
76
|
-
# @return [RestClient::Response] Response object
|
77
|
-
def authenticator_authenticate_get authenticator, service_id, account: Conjur.configuration.account, options: {}
|
78
66
|
if Conjur.log
|
79
67
|
Conjur.log << "Authenticating to account #{account} using #{authenticator}/#{service_id}\n"
|
80
68
|
end
|
81
|
-
url_for(:authenticator_authenticate, account, service_id, authenticator, options).get
|
69
|
+
JSON.parse url_for(:authenticator_authenticate, account, service_id, authenticator, options).get
|
82
70
|
end
|
83
71
|
|
84
72
|
# Exchanges Conjur the API key (refresh token) for an access token. The access token can
|
@@ -13,7 +13,7 @@ describe "Conjur::API.host_factory_create_host", api: :dummy do
|
|
13
13
|
resource = instance_double(RestClient::Resource, "hosts")
|
14
14
|
)
|
15
15
|
|
16
|
-
allow(resource).to receive(:post).with(
|
16
|
+
allow(resource).to receive(:post).with(id: id).and_return(
|
17
17
|
instance_double(RestClient::Response, "host response", body: '
|
18
18
|
{
|
19
19
|
"id": "test-host",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjur-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.0
|
4
|
+
version: 5.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CyberArk Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -410,9 +410,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
410
410
|
version: '1.9'
|
411
411
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
412
412
|
requirements:
|
413
|
-
- - "
|
413
|
+
- - ">="
|
414
414
|
- !ruby/object:Gem::Version
|
415
|
-
version:
|
415
|
+
version: '0'
|
416
416
|
requirements: []
|
417
417
|
rubygems_version: 3.2.33
|
418
418
|
signing_key:
|