AuthController
All Group Control Apps, rather than extending the FW Core's AbstractController
, which is documented here, extend Group Control's AuthController
. The AuthController
does extend the basic AbstractController
, but it adds in Group Control related features, especially to do with authenticating users.
Setup AuthController
To extend the AuthController
, just use the following code:
namespace MyApp\Controller;
class SomeController extends GroupControl\Controller\AuthController {
}
In many cases, each app will define their own AuthController
which extends GC's (with no changes), so they can simplify the extend statement in each of their other Controller files.
Using AuthController
AuthController
adds three things to the AbstractController
it extends. It adds the auth
and check
functions, which are thoroughly documented in Auth Core's documentation about how to authenticate requests. It also adds a $user
variable, which is an instance of the CurrentUser
class, which will be discussed on the next page.
For now though, it is helpful to know that you have access to this CurrentUser
instance in every controller, by simply calling $this->user
.