public boolean signIn(String username, String password, String realm) { boolean signedIn = authenticate(username, password, realm); if (signedIn) { LOG.info("User '" + SecurityUtil.getLoggedUsername() + "' sign in " + signedIn); AuditEvent auditEvent = new AuditEvent("Sign in"); auditEvent.setUsername(SecurityUtil.getLoggedUsername()); auditor.logEvent(auditEvent); } else { LOG.info("User '" + username + "' sign in " + signedIn); AuditEvent auditEvent = new AuditEvent("Sign in failed"); auditEvent.setUsername(username); auditor.logEvent(auditEvent); } return signedIn; }
public String getUsername() { if (!isSignedIn()) { return null; } return SecurityUtil.getLoggedUsername(); }
public void setPreferences(Map<String, String> preferences) { String username = SecurityUtil.getLoggedUsername(); UserPreferences userPreferences; try { userPreferences = (UserPreferences) storageService.getEntity(UserPreferences.getPath(username)); } catch (NotFoundException e) { userPreferences = new UserPreferences(username); } userPreferences.setPreferences(preferences); storageService.addOrModifyEntity(userPreferences); }
private User getUser() { return SecurityUtil.getLoggedUser(); }
public boolean isSignedIn() { return (SecurityUtil.getLoggedUser() != null); }