Skip to content

fix: Add authentication to support-scheduler actions#4419

Merged
bnevis-i merged 2 commits intoedgexfoundry:mainfrom
bnevis-i:scheduler-authentication
Mar 8, 2023
Merged

fix: Add authentication to support-scheduler actions#4419
bnevis-i merged 2 commits intoedgexfoundry:mainfrom
bnevis-i:scheduler-authentication

Conversation

@bnevis-i
Copy link
Copy Markdown
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 requested a review from lenny-goodell March 8, 2023 00:49
@bnevis-i bnevis-i added this to the Minnesota milestone Mar 8, 2023
@codecov-commenter
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud 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 bnevis-i requested a review from lenny-goodell March 8, 2023 21:26
@bnevis-i
Copy link
Copy Markdown
Collaborator Author

bnevis-i commented Mar 8, 2023

@lenny-intel Ready for re-review.

Copy link
Copy Markdown
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