auth()helper method (which is actually just a shortcut to a wirebox injection). The
auth()helper is very useful in views. And since Wirebox handles singleton management, you don't have to worry about calling
auth()too many times.
auth()helper is available in handlers, layouts, and views. You will need to use the injection if you need cbauth in other models.
getId()method (as defined in the
IAuthUserinterface). Additionally, the user is cached in the
requestscope. If a user is already in the session, this will replace it with the given user. This method returns the passed in
isValidCredentialson the provided
false, it throws a
userobject. If it succeeds, it also sets the user id (obtained by calling
getId()on the returned user component) in the configured
sessionStorageand the returned user component in the configured
booleanwhether a user is logged in to the system.
requestStorage, it is returned.
sessionStorageto fetch the user (using
retrieveUserById). It then sets the user in the configured
requestStorageso subsequent calls to
getUserdon't re-fetch the user.