user.setSubject(new Subject.Builder(SecurityUtils.getSecurityManager())
.principals(new SimplePrincipalCollection(user.getName(), "REST realm"))
.authenticated(true)
.buildSubject());
} catch (IOException e) {
throw new Graylog2ServerUnavailableException("Could not connect to Graylog2 Server.", e);
} catch (APIException e) {
if (e.getCause() != null && e.getCause() instanceof ConnectException) {
throw new Graylog2ServerUnavailableException("Could not connect to Graylog2 Server.", e);
} else {
throw new AuthenticationException("Unable to communicate with graylog2-server backend", e);
}
} catch (PlayException e) {
log.error("Misconfigured play application. Please make sure your application.secret is longer than 16 characters!", e);