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

ROX-23255: add auth implementation for emailsender API #1826

Merged
merged 7 commits into from
Jun 7, 2024

Conversation

johannes94
Copy link
Contributor

@johannes94 johannes94 commented May 24, 2024

Description

Checklist (Definition of Done)

  • Unit and integration tests added
  • Added test description under Test manual
  • Documentation added if necessary (i.e. changes to dev setup, test execution, ...) -> will be added once emailsender is ready to be worked on by others
  • CI and all relevant tests are passing
  • Add the ticket number to the PR title if available, i.e. ROX-12345: ...
  • Discussed security and business related topics privately. Will move any security and business related topics that arise to private communication channel.
  • Add secret to app-interface Vault or Secrets Manager if necessary
  • RDS changes were e2e tested manually
  • Check AWS limits are reasonable for changes provisioning new resources
  • (If applicable) Changes to the dp-terraform Helm values have been reflected in the addon on integration environment

Test manual

Additional to the added unit tests I tested the API as follows:

# Start emailservice
export CLUSTER_ID=test
go run emailsender/cmd/app/main.go

# By default the authentication configuration will allow calling the API with a OCM token of any
# engineer in the ACS organization, so make sure you're logged in to ocm.

# Run
curl localhost:8080/api/v1/acscsemail -H "Authorization: Bearer $(ocm token)" -H "Content-Type: application/json" -XPOST --data-raw '{"to":["[email protected]"],"rawMessage":"dGVzdCBtZXNzYWdlIGNvbnRlbnQ="}' -v
# Should yield a 200 status code

# Run the same without auth header
curl localhost:8080/api/v1/acscsemail -H "Content-Type: application/json" -XPOST --data-raw '{"to":["[email protected]"],"rawMessage":"dGVzdCBtZXNzYWdlIGNvbnRlbnQ="}'
# Should yield a 401 status code
# To run tests locally run:
make db/teardown db/setup db/migrate
make ocm/setup
make verify lint binary test test/integration

Copy link
Contributor

openshift-ci bot commented May 24, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@johannes94 johannes94 force-pushed the jmalsam/ROX-23255-emailsender-auth branch from 15fc1c2 to a064cd4 Compare June 3, 2024 11:42
@johannes94 johannes94 marked this pull request as ready for review June 3, 2024 11:42
@johannes94 johannes94 requested a review from kurlov June 4, 2024 04:14
@johannes94 johannes94 force-pushed the jmalsam/ROX-23255-emailsender-auth branch from a6f3b89 to 907b70a Compare June 4, 2024 06:09
@johannes94 johannes94 force-pushed the jmalsam/ROX-23255-emailsender-auth branch from 907b70a to 0d9440c Compare June 4, 2024 08:57
Copy link
Contributor

openshift-ci bot commented Jun 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johannes94, kurlov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot removed the lgtm label Jun 6, 2024
Copy link
Contributor

openshift-ci bot commented Jun 6, 2024

New changes are detected. LGTM label has been removed.

@johannes94
Copy link
Contributor Author

/retest

looks like infrastructure related failure

@johannes94 johannes94 merged commit 87fc497 into main Jun 7, 2024
6 checks passed
@johannes94 johannes94 deleted the jmalsam/ROX-23255-emailsender-auth branch June 7, 2024 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants