use of org.alfresco.events.types.Event in project alfresco-remote-api by Alfresco.
the class AbstractLoginBean method login.
protected Map<String, Object> login(final String username, String password) {
try {
// get ticket
authenticationService.authenticate(username, password.toCharArray());
eventPublisher.publishEvent(new EventPreparator() {
@Override
public Event prepareEvent(String user, String networkId, String transactionId) {
// TODO need to fix up to pass correct seqNo and alfrescoClientId
return new RepositoryEventImpl(-1l, "login", transactionId, networkId, new Date().getTime(), username, null);
}
});
// add ticket to model for javascript and template access
Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
model.put("username", username);
model.put("ticket", authenticationService.getCurrentTicket());
return model;
} catch (AuthenticationException e) {
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Login failed");
} finally {
AuthenticationUtil.clearCurrentSecurityContext();
}
}
Aggregations