jenkinsci / oic-auth-plugin

A Jenkins plugin which lets you login to Jenkins using your own, self-hosted or public openid connect server.
https://plugins.jenkins.io/oic-auth
MIT License
71 stars 88 forks source link

Set up an error page when the token could not be validated. #344

Closed Vlatombe closed 2 months ago

Vlatombe commented 2 months ago

When using Token Field Key To Check and Token Field Value To Check to restrict login access to an instance, if a user that doesn't match the specified criteria, you get a HTTP 401 error

Capture d’écran 2024-06-24 à 17 18 23

This introduces a nicer error page, providing a link to log out from the OpenID Connect Provider (if configured).

Capture d’écran 2024-06-25 à 12 52 52

Testing done

Tested manually with a configured Token Field Key To Check/Token Field Value To Check and combinations where the user matches the token field or doesn't match it.

Submitter checklist

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.59%. Comparing base (bca3705) to head (134c292). Report is 6 commits behind head on master.

Files Patch % Lines
...va/org/jenkinsci/plugins/oic/OicSecurityRealm.java 95.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #344 +/- ## ============================================ + Coverage 72.46% 73.59% +1.12% - Complexity 201 209 +8 ============================================ Files 9 10 +1 Lines 839 852 +13 Branches 119 120 +1 ============================================ + Hits 608 627 +19 + Misses 170 163 -7 - Partials 61 62 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Vlatombe commented 2 months ago

@michael-doubez This is ready to be reviewed