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

Simplify OpenQA::WebAPI::Auth::OpenID #4156

Merged
merged 6 commits into from
Jul 16, 2024
Merged

Conversation

okurz
Copy link
Member

@okurz okurz commented Aug 30, 2021

  • Use signatures in OpenQA::WebAPI::Auth::OpenID
  • Simplify OpenQA::WebAPI::Auth::OpenID

@okurz okurz marked this pull request as draft August 30, 2021 10:34
@kraih
Copy link
Member

kraih commented Aug 30, 2021

I wouldn't put too much effort into this. With OpenID Connect support coming to Mojolicious::Plugin::OAuth2 and legacy OpenID being deprecated, we should be able to get rid of this code at some point in the not so distant future.

@okurz
Copy link
Member Author

okurz commented Aug 30, 2021

I agree. But the above refactoring was really just a 10 minute effort while actively reviewing #4151

@okurz

This comment was marked as resolved.

@okurz okurz marked this pull request as ready for review November 23, 2021 10:10
@os-autoinst os-autoinst deleted a comment from mergify bot Nov 23, 2021
@Martchus
Copy link
Contributor

Martchus commented Nov 23, 2021

Unfortunately the patch coverage doesn't look great. So at least also test it manually.

@okurz okurz added the acceptance-tests-needed Needed for code that is required to be tested on a production-like environment label Nov 23, 2021
@okurz okurz marked this pull request as draft November 23, 2021 12:24
@okurz
Copy link
Member Author

okurz commented Nov 23, 2021

I tested locally with

sed -i 's/^# method = .*OpenID/method = OpenID/;s/^#httpsonly = 1/httpsonly = 0/' etc/openqa/openqa.ini
NOT_HEADLESS=1 perl -Ilib -d t/ui/01-list.t

and hit

Can't locate object method "_handle_verified" via package "OpenQA::Shared::Controller::Session" at lib/OpenQA/WebAPI/Auth/OpenID.pm line 122

likely we should try to increase the test coverage with automatic tests.

@stale

This comment was marked as resolved.

@okurz
Copy link
Member Author

okurz commented Aug 16, 2022

I extended unit tests also for the method _handle_verified but I am still running into

Can't locate object method "_handle_verified" via package "OpenQA::Shared::Controller::Session" at lib/OpenQA/WebAPI/Auth/OpenID.pm line 122

when running something like NOT_HEADLESS=1 perl -Ilib -d t/ui/01-list.t. Some help would be appreciated.

@mergify

This comment was marked as resolved.

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

The patch coverage check is still complaining but the change looks generally good (code is mainly moved around).

lib/OpenQA/WebAPI/Auth/OpenID.pm Show resolved Hide resolved
@kraih
Copy link
Member

kraih commented Nov 2, 2022

That reminds me, i've replaced OpenID with OpenID Connect in Cavil now. The change can probably be replicated for openQA to simplify OpenQA::WebAPI::Auth::OpenID further. openSUSE/cavil@24b08a5

@okurz
Copy link
Member Author

okurz commented Nov 2, 2022

That reminds me, i've replaced OpenID with OpenID Connect in Cavil now. The change can probably be replicated for openQA to simplify OpenQA::WebAPI::Auth::OpenID further. openSUSE/cavil@24b08a5

That looks nice. Would be cool if you could propose a PR doing that.

@okurz
Copy link
Member Author

okurz commented Nov 2, 2022

The patch coverage check is still complaining but the change looks generally good (code is mainly moved around).

Yes, we should extend test coverage first. If anyone of you fancies doing so be my guest otherwise a candidate for a mob session.

@kraih
Copy link
Member

kraih commented Nov 2, 2022

That looks nice. Would be cool if you could propose a PR doing that.

Sure, once it's in the backlog. 😉 https://progress.opensuse.org/issues/89023

@mergify

This comment was marked as resolved.

@stale

This comment was marked as resolved.

@stale stale bot added the stale label Jun 17, 2023

This comment was marked as resolved.

1 similar comment

This comment was marked as resolved.

@okurz okurz force-pushed the enhance/openid branch 2 times, most recently from f947af2 to 93f0cb4 Compare March 2, 2024 18:59
@stale stale bot removed the stale label Mar 2, 2024
@okurz okurz force-pushed the enhance/openid branch 2 times, most recently from f64a143 to 78a9e47 Compare March 2, 2024 20:04
Copy link

codecov bot commented Mar 2, 2024

Codecov Report

Attention: Patch coverage is 91.52542% with 5 lines in your changes missing coverage. Please review.

Project coverage is 98.49%. Comparing base (2d77acd) to head (f3c5f75).

Files Patch % Lines
lib/OpenQA/WebAPI/Auth/OpenID.pm 84.84% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4156      +/-   ##
==========================================
+ Coverage   98.44%   98.49%   +0.04%     
==========================================
  Files         393      394       +1     
  Lines       38631    38657      +26     
==========================================
+ Hits        38032    38074      +42     
+ Misses        599      583      -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@okurz okurz force-pushed the enhance/openid branch 2 times, most recently from 68abe94 to fca4e7f Compare July 16, 2024 13:00
@okurz
Copy link
Member Author

okurz commented Jul 16, 2024

Fixed the problem #4156 (comment) with help from @Martchus . I shouldn't try to call member methods on the object when those are actually called on the controller. Now properly calling those functions as free functions with $c as first argument. Maybe that was all that was necessary

@okurz okurz removed the acceptance-tests-needed Needed for code that is required to be tested on a production-like environment label Jul 16, 2024
@okurz okurz marked this pull request as ready for review July 16, 2024 13:01
lib/OpenQA/Setup.pm Outdated Show resolved Hide resolved
Tested with

```
rm -rf cover_db/ && cover -coverage stmt -test -make 'prove -Ilib t/03-auth-openid.t; echo 0' && html2text cover_db/lib-OpenQA-WebAPI-Auth-OpenID-pm.html
```

this can be used to extend further and cover more paths.
@okurz
Copy link
Member Author

okurz commented Jul 16, 2024

Everything good except patch coverage. As agreed in before merging based on manual test results.

@okurz okurz merged commit 1dac9c1 into os-autoinst:master Jul 16, 2024
46 of 47 checks passed
@okurz okurz deleted the enhance/openid branch July 16, 2024 19:28
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.

4 participants