subfission / cas

Simple CAS Authentication for Laravel 5 - 10.
MIT License
151 stars 70 forks source link

how use CAS with spatie laravel-permission #87

Closed cod3r0k closed 1 year ago

cod3r0k commented 3 years ago

Hi, I want to use CAS library and then use spatie laravel-permission for the permission of my laravel app.

Could you help me how can I integrate and use them?

subfission commented 3 years ago

Likely this would be integrated into an auth driver, middleware, and a model. Perhaps try stackoverflow?

coolsam726 commented 3 years ago

Hi, I want to use CAS library and then use spatie laravel-permission for the permission of my laravel app.

Could you help me how can I integrate and use them?

I don't see how these two depend on each other. I personally use both packages in all my project. Here is my Authentication logic:

Authentication:

  1. I have internal users table with a username field that corresponds to the one returned by the cas service.
  2. Redirect to the CAS endpoint for authentication. Once authenticated, this simply returns a username.
  3. Find a user with the returned username. If found, Login the user manually using Laravel's Auth::login($user) feature

Authorization: Follow the normal procedure outlined in spatie/laravel-permission's documentation. There won't be any conflicts.