use of org.xdi.ldap.model.CustomEntry in project oxAuth by GluuFederation.
the class ClientService method updatAccessTime.
public void updatAccessTime(Client client, boolean isUpdateLogonTime) {
if (!appConfiguration.getUpdateClientAccessTime()) {
return;
}
String clientDn = client.getDn();
CustomEntry customEntry = new CustomEntry();
customEntry.setDn(clientDn);
customEntry.setCustomObjectClasses(CLIENT_OBJECT_CLASSES);
Date now = new GregorianCalendar(TimeZone.getTimeZone("UTC")).getTime();
CustomAttribute customAttributeLastAccessTime = new CustomAttribute("oxLastAccessTime", now);
customEntry.getCustomAttributes().add(customAttributeLastAccessTime);
if (isUpdateLogonTime) {
CustomAttribute customAttributeLastLogonTime = new CustomAttribute("oxLastLogonTime", now);
customEntry.getCustomAttributes().add(customAttributeLastLogonTime);
}
try {
ldapEntryManager.merge(customEntry);
} catch (EntryPersistenceException epe) {
log.error("Failed to update oxLastAccessTime and oxLastLoginTime of client '{}'", clientDn);
}
removeFromCache(client);
}
use of org.xdi.ldap.model.CustomEntry in project oxAuth by GluuFederation.
the class AuthenticationService method updateLastLogonUserTime.
private void updateLastLogonUserTime(User user) {
if (!appConfiguration.getUpdateUserLastLogonTime()) {
return;
}
CustomEntry customEntry = new CustomEntry();
customEntry.setDn(user.getDn());
customEntry.setCustomObjectClasses(UserService.USER_OBJECT_CLASSES);
CustomAttribute customAttribute = new CustomAttribute("oxLastLogonTime", new Date());
customEntry.getCustomAttributes().add(customAttribute);
try {
ldapEntryManager.merge(customEntry);
} catch (EntryPersistenceException epe) {
log.error("Failed to update oxLastLoginTime of user '{}'", user.getUserId());
}
}
Aggregations