if (context == null) {
boolean isAuthenticated = authenticationService.authenticate(principal, credentials[1]);
if (isAuthenticated) {
String token = UUID.randomUUID().toString();
context = new Context(token, principal);
context.grant(Permission.ACCESS);
contexts.put(token, context);
LOG.debug(String.format("Added principal %s to context store", principal));
}
}
else {