robsontenorio / laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel
MIT License
434 stars 141 forks source link

Acting as a Keycloak user in tests #103

Closed hamidhaghdoost closed 8 months ago

hamidhaghdoost commented 10 months ago

As mentioned in #96, in cases where we have a user in our database, we can use Laravel's built-in actingAs method to act as a user for authentication. However, most of the time, our users are stored in Keycloak, so we just need a way to bypass the middleware.

This MR adds this feature to the package. There are some duplicated codes in test files and the trait that should be refactored. If the MR is acceptable, I can refactor it a bit.

robsontenorio commented 10 months ago

Thanks @tuytoosh !

Go ahead with refactoring. I will accept this.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (cc051f5) to head (4bf5622).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #103 +/- ## =========================================== Coverage 100.00% 100.00% - Complexity 43 47 +4 =========================================== Files 4 5 +1 Lines 112 138 +26 =========================================== + Hits 112 138 +26 ```

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

hamidhaghdoost commented 8 months ago

Hi @robsontenorio

Could you please check if it is fine?

robsontenorio commented 8 months ago

Thank you !