Need help with plugin for SAML authentication
Yii provides a CUserIdentity class that is meant for your typical username/password form/cookie-based authentication.  Craft extends that a bit and uses that in it's own UserIdentity class for logging into the control panel, etc.

But ultimately, Yii's CUserIdentity implements the IUserIdentity interface, which they intend for people to use that want to implement their own custom authentication mechanisms.

So you'd probably want to write a SamlUserIdentity class that implements the interface, provides it's own authentication logic (calls the Identity Provider, etc) and handles the interactions between Yii/Craft and SAML.

If you just want to enforce an authenticated session from the template, use:

{% requireLogin %}


If you want to do it from a controller's action, use:

$this-&gt;requireLogin();