Skip to content

Enh/add auth#96

Merged
MBueschelberger merged 26 commits intoEMMC-ASBL:masterfrom
MBueschelberger:enh/add_auth
May 23, 2023
Merged

Enh/add auth#96
MBueschelberger merged 26 commits intoEMMC-ASBL:masterfrom
MBueschelberger:enh/add_auth

Conversation

@MBueschelberger
Copy link
Contributor

Description:

Type of change:

  • Bug fix.
  • New feature.
  • Documentation update.

Checklist for the reviewer:

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?

Related to the implementations from this PR, a simple inclusion of the http-headers into the request-objects for the services has been added.

Since there are multiple ways to fetch and pass an access-token from a broker to an application, I think it makes sense to only pass custom headers for now when the OTEClient is launched.

E.g. if a sophisticated solution in the services requires an API-token from an identity broker, the related secret cannot be simply retrieved by basic http-logins with user/password on a script basis.

Since I do not provide a generic solution with this PR, the user needs to be able to set his own headers. A generic solution might be to complex for the time remaining in the use case.

Copy link
Contributor

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

It seems there were some changes at the top of files that seem to be the beginning of further changes that were then never made?
Also, please add the self.headers usage for all resource classes under services for all requests.

@MBueschelberger
Copy link
Contributor Author

Hi @CasperWA, this PR is way overdue, I will take a look tomorrow ASAP.

Sorry for that!

@CasperWA
Copy link
Contributor

I tried to update it as best I could, concerning the latest PR with major changes for the client implementation.
I think the major part here is to ensure headers are used throughout for the services client. I was thinking it might be nice with some optional "config" keyword-args for the client upon initialization, spitting out warnings if configuration options were given that weren't used by the client - so I set that up, but didn't thoroughly test it.

@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2023

Codecov Report

Patch coverage: 95.12% and project coverage change: +0.33 🎉

Comparison is base (8eec3c8) 90.48% compared to head (389e2c7) 90.82%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   90.48%   90.82%   +0.33%     
==========================================
  Files          25       26       +1     
  Lines         389      425      +36     
==========================================
+ Hits          352      386      +34     
- Misses         37       39       +2     
Flag Coverage Δ
linux 90.82% <95.12%> (+0.33%) ⬆️
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
otelib/backends/services/base.py 97.95% <91.66%> (-2.05%) ⬇️
otelib/backends/services/client.py 96.29% <93.75%> (-3.71%) ⬇️
otelib/backends/client.py 93.33% <100.00%> (+1.66%) ⬆️
otelib/backends/python/client.py 92.30% <100.00%> (ø)
otelib/client.py 100.00% <100.00%> (ø)
otelib/warnings.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Only a single custom warning is used for now, which is to warn the user
if any given configuration options for the clients are not actually
used.
@CasperWA
Copy link
Contributor

I added a otelib.warnings module, with a custom OTELib warning class that we can detect in the test. Also, I simplified your test a bit, reusing existing pytest fixtures and such. In theory, one could separate it in two tests (for valid and invalid config values), but ... meh.

@CasperWA
Copy link
Contributor

@MBueschelberger I am unfortunately running out of work hours. Is there anything here that still needs to be addressed? Maybe one of your comments above to my review? That's about it what I can understand?
Concerning that specific comment, I think it is a bit out-of-scope for this PR, so I have no problem raising it as a separate issue and moving further discussions there? That means we should(?) be able to then merge this... :)

@MBueschelberger MBueschelberger enabled auto-merge (squash) May 23, 2023 14:19
@MBueschelberger MBueschelberger merged commit 3aff14b into EMMC-ASBL:master May 23, 2023
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