user.lastLogin = new Date();
user.linkedAccounts = Collections.singletonList(LinkedAccount
.create(authUser));
if (authUser instanceof EmailIdentity) {
final EmailIdentity identity = (EmailIdentity) authUser;
// Remember, even when getting them from FB & Co., emails should be
// verified within the application as a security breach there might
// break your security as well!
user.email = identity.getEmail();
user.emailValidated = false;
}
if (authUser instanceof NameIdentity) {
final NameIdentity identity = (NameIdentity) authUser;
final String name = identity.getName();
if (name != null) {
user.name = name;
}
}
if (authUser instanceof FirstLastNameIdentity) {
final FirstLastNameIdentity identity = (FirstLastNameIdentity) authUser;
final String firstName = identity.getFirstName();
final String lastName = identity.getLastName();
if (firstName != null) {
user.firstName = firstName;
}
if (lastName != null) {
user.lastName = lastName;