/**
* Prepare to send a message back to the client, informing it that a successful login has
* been performed.
*/
ConversationMessage successfulMsg = ConversationMessage.create(message)
.command(SecurityCommands.SuccessfulAuth)
.toSubject("LoginClient")
.set(SecurityParts.Roles, authSubject.toRolesString())
.set(SecurityParts.Name, name);
try {
ResourceBundle bundle = ResourceBundle.getBundle("errai");
String motdText = bundle.getString("errai.login_motd");
/**
* If the MOTD is configured, then add it to the message.
*/
if (motdText != null) {
successfulMsg.set(MessageParts.MessageText, motdText);
}
}
catch (Exception e) {
// do nothing.
}
/**
* Transmit the message back to the client.
*/
successfulMsg.sendNowWith(bus);
}
catch (LoginException e) {
/**
* The login failed. How upsetting. Life must go on, and we must inform the client of the
* unfortunate news.