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

fix: Add authentication to support-scheduler actions #4419

Merged
merged 2 commits into from
Mar 8, 2023
Merged

fix: Add authentication to support-scheduler actions #4419

merged 2 commits into from
Mar 8, 2023

Conversation

bnevis-i
Copy link
Collaborator

@bnevis-i bnevis-i commented Mar 8, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

The easiest way to test this change is to modify support-scheduler configuration.toml and set the Midnight interval to a period of "5m" (five minutes). Then make docker (make clean_docker_base docker_base docker), then from edgex-compose/compose-builder run make run dev. Then do docker logs -f edgex-core-data and wait for the following log message to appear:

level=INFO ts=2023-03-08T00:45:00.109776605Z app=core-data source=auth_middleware.go:50 msg="Authorizing incoming call to '/api/v2/event/age/604800000000000' via JWT (Authorization len=467)"
level=INFO ts=2023-03-08T00:45:00.124832092Z app=core-data source=auth_middleware.go:64 msg="Request to '/api/v2/event/age/604800000000000' authorized"

If the incoming JWT length == 0, then this fix didn't catch and try again. Otherwise, the request will be authorized after this fix.

New Dependency Instructions (If applicable)

Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
@bnevis-i bnevis-i added this to the Minnesota milestone Mar 8, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #4419 (54caeec) into main (58b8fd4) will decrease coverage by 0.03%.
The diff coverage is 16.66%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #4419      +/-   ##
==========================================
- Coverage   41.76%   41.73%   -0.03%     
==========================================
  Files         106      106              
  Lines        9740     9749       +9     
==========================================
+ Hits         4068     4069       +1     
- Misses       5325     5333       +8     
  Partials      347      347              
Impacted Files Coverage Δ
internal/pkg/utils/restaddress.go 0.00% <0.00%> (ø)
...support/scheduler/application/scheduler/manager.go 12.16% <25.00%> (+0.39%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

_, err := utils.SendRequestWithRESTAddress(m.lc, action.Content, action.ContentType, restAddress)

var jwtSecretProvider clientInterfaces.AuthenticationInjector
// Awaiting change to go-mod-core-contracts
Copy link
Member

Choose a reason for hiding this comment

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

Is this still valid? Waiting foe what? Should start with a TODO: so readers know it needs to be addressed.

Copy link
Collaborator Author

@bnevis-i bnevis-i Mar 8, 2023

Choose a reason for hiding this comment

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

Changed the code without removing the comment. Yes, this is done. (Will fix.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Misleading comment removed in fac7cbe

Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
@sonarcloud
Copy link

sonarcloud bot commented Mar 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Mar 8, 2023

@lenny-intel Ready for re-review.

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@bnevis-i bnevis-i merged commit 923421b into edgexfoundry:main Mar 8, 2023
@bnevis-i bnevis-i deleted the scheduler-authentication branch March 8, 2023 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants