Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable gcp authenticator #2448

Merged
merged 3 commits into from
Dec 21, 2021
Merged

Enable gcp authenticator #2448

merged 3 commits into from
Dec 21, 2021

Conversation

aloncarmel111
Copy link
Contributor

Desired Outcome

I want to be able to enable GCP authenticator on Conjur, so I could authenticate using authn-gcp authenticator, to authenticate securely on GCP platform.

Currently to enable authenticator, the user needs to run REST API request to enable the authenticator. The REST doesn't support authenticator that doesn't have serviceid.

We should add the ability to enable authenticator that missing service-id.

Implemented Changes

We want to use the existing REST API endpoint, and update service-id to be optional parameter in the URL
Before change:
patch '/:authenticator/:service_id/:account' => 'authenticate#update_config'

After change:
patch '/:authenticator/(:service_id)/:account' => 'authenticate#update_config'

Connected Issue/Story

Resolves #2389

Definition of Done

At least 1 todo must be completed in the sections below for the PR to be
merged.

Changelog

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a
    CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code
    changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR
  • A follow-up issue to update official docs has been filed here: insert issue ID
  • This PR does not require updating any documentation

Behavior

  • This PR changes product behavior and has been reviewed by a PO, or
  • These changes are part of a larger initiative that will be reviewed later, or
  • No behavior was changed with this PR

Security

  • Security architect has reviewed the changes in this PR,
  • These changes are part of a larger initiative with a separate security review, or
  • There are no security aspects to these changes

uCatu
uCatu previously approved these changes Dec 20, 2021
@@ -21,7 +21,7 @@ def validate_webservice_is_configured_authenticator
end

def webservice_id
"#{@webservice.authenticator_name}/#{@webservice.service_id}"
@webservice.service_id.blank? ? @webservice.authenticator_name : "#{@webservice.authenticator_name}/#{@webservice.service_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in this place you should call function that checks if the authenticator is with mandatory for service id?

tzheleznyak
tzheleznyak previously approved these changes Dec 21, 2021
Copy link
Contributor

@tzheleznyak tzheleznyak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -25,7 +25,7 @@ def matches?(request)
get '/authn-jwt/:service_id/:account/status' => 'authenticate#authn_jwt_status'
get '/:authenticator(/:service_id)/:account/status' => 'authenticate#status'

patch '/:authenticator/:service_id/:account' => 'authenticate#update_config'
patch '/:authenticator(/:service_id)/:account' => 'authenticate#update_config'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT on the following change?

patch '/:authn-gcp/:account' => 'authenticate#update_config'
patch '/:authenticator/:service_id/:account' => 'authenticate#update_config'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think that there are some other authenticator define with service-id as an optional parameter

"""
And authenticator "cucumber:webservice:conjur/authn-gcp" is disabled

Scenario: Authenticated user can not update authenticator without service-id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the headline is misleading , did you meant to test here an unauthorized user ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes fixed the scenario name

"""
enabled=true
"""
Then the HTTP response status code is 401
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you will agree to my change above o thin that here you will get 404 instead of 401

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will get also 401 because the url is still valid

CHANGELOG.md Outdated
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added
- Added API endpoint to enable and disable GCP authenticator. [#2448](https://github.com/cyberark/conjur/pull/2448)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lists should be surrounded by blank lines

@codeclimate
Copy link

codeclimate bot commented Dec 21, 2021

Code Climate has analyzed commit e4f5fa5 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 1
Complexity 2

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 91.0% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@nessiLahav nessiLahav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@tzheleznyak tzheleznyak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexkalish
Copy link
Contributor

Internal issue link.

@aloncarmel111 aloncarmel111 deleted the enable-gcp-authenticator branch April 13, 2022 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants