-
Notifications
You must be signed in to change notification settings - Fork 0
Auth
Authentication
Authentication is ensuring that the current user is logged in. Some parts of your application are limited to authenticated users. Mettle does not implement authentication, but it does provide a mechanism for integrating Secure-Social or other Play authentication add-ons.
The Command class has a member
public String indentityId;
If you are using integration then this field is used to indicate whether the user is logged in or not.
The Presenter provides two methods
boolean isLoggedIn(Command cmd);
void ensureLoggedIn(Command cmd);
The first method returns a boolean, so your presenter can support both logged-in and non-logged-in users. The second method throws a NotLoggedInException if the user is not logged in. This is caught by the base Presenter and converted into a Reply destination of Reply.FORWARD_NOT_AUTHENTICATED. Usually your controller will response to this destination by redirecting to an error page.