CAS login plugin

plugin
#1

I want to create a plugin that will override the login before the admin page.

I want the user to be redirected to the CAS server and then return back.
I am not quite sure how to do it.
Any headers for the events that I need to override and what way do you advise me to take?
What things should I look out for?
I have tried checking other login plugins but either I couldn’t make them work or they were older versions.
Any help will be appreciated!!
Thanks in advance

#2

Update

Included with composer jasig phpCAS package inside my plugin
used it my plugin.php using namespace \phpCAS::

Override events used:

  1. ‘onUserLoginAuthenticate’ (before login form)
  2. onUserLogout’

Currently my plugin works in parallel with grav’s login plugin and I haven’t figured out the best way to override the login plugin.
In short I want to login as admin through only my own CAS login plugin.
I tried disabling login but grav’s admin plugin needs it enabled.
Is there an advisable way to do this?