@GET @Path("/reloadAccumuloAuths") @Produces({"application/xml", "text/xml", "application/json"}) public GenericResponse<String> reloadAccumuloAuthorizations() { GenericResponse<String> response = new GenericResponse<>(); try { retrieveAccumuloAuthorizations(); response.setResult("Authorizations reloaded. Remember to flush the principals cache to ensure principals are reloaded with new auths applied."); return response; } catch (Exception e) { response.setResult("Unable to reload Accumulo authorizations."); throw new DatawaveWebApplicationException(e, response); } }
final GenericResponse<String> errorReponse = new GenericResponse<>(); errorReponse.addMessage(message); throw new DatawaveWebApplicationException(new IllegalArgumentException(message), errorReponse); final GenericResponse<String> errorReponse = new GenericResponse<>(); errorReponse.addMessage(message); throw new DatawaveWebApplicationException(new IllegalArgumentException(message), errorReponse); final GenericResponse<String> errorReponse = new GenericResponse<>(); errorReponse.addMessage(message); throw new DatawaveWebApplicationException(new IllegalArgumentException(message), errorReponse);
/** * Clears any cached credentials for the calling user. The end result is that future calls to other methods on this application will require outside contact * with the authentication provider. * * If the credentials are for a single user with no proxy involved, these are the only credentials flushed. Otherwise, if there is a proxy chain, this will * flush the DN for the user in the proxy (assumes there is never more than one user in the proxy chain). */ @GET @Path("/flushCachedCredentials") @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) @PermitAll public GenericResponse<String> flushCachedCredentials() { GenericResponse<String> response = new GenericResponse<>(); Principal callerPrincipal = context.getCallerPrincipal(); log.info("Flushing credentials for " + callerPrincipal + " from the cache."); if (callerPrincipal instanceof DatawavePrincipal) { DatawavePrincipal dp = (DatawavePrincipal) callerPrincipal; response.setResult(credentialsCache.evict(dp.getUserDN().subjectDN())); } else { log.warn(callerPrincipal + " is not a DatawavePrincipal. Cannot flush credentials."); response.addMessage("Unable to determine calling user name. Values were not flushed!"); throw new DatawaveWebApplicationException(new IllegalStateException("Unable to flush credentials. Unknown principal type."), response); } return response; }
@POST @Path("/audit") @Consumes("*/*") @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) @GZIP public VoidResponse auditRest(MultivaluedMap<String,String> parameters) { VoidResponse response = new VoidResponse(); try { auditService.audit(auditParameterBuilder.validate(parameters)); return response; } catch (Exception e) { QueryException qe = new QueryException(DatawaveErrorCode.AUDITING_ERROR, e); log.error(qe); response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode); } }
/** * Removes all cached {@link DatawaveUser}s. There are potentially two caches in use. First, Wildfly uses a security cache that stores {@link Principal}s * under the incoming credential key. This is normally a very short-lived cache (5-30 minutes). Second, a {@link CachedDatawaveUserService} may be in use, * which means that it caches according to its own rules. This method attempts to clear both caches. * * @return a string indicating cache flush was successful */ @GET @Path("/flushAll") @JmxManaged public String flushAll() { try { // Remove principals from the Wildfly cached authentication manager, if we have one in use. authManager.flushCache(); if (!cachedDatawaveUserServiceInstance.isUnsatisfied()) { cachedDatawaveUserServiceInstance.get().evictAll(); } return "All credentials caches cleared."; } catch (Exception e) { GenericResponse<String> response = new GenericResponse<>(); response.addException(new QueryException(UNKNOWN_SERVER_ERROR, e)); throw new DatawaveWebApplicationException(e, response); } }
log.error(qe); response.addException(qe.getBottomQueryException()); throw new DatawaveWebApplicationException(qe, response); } finally { if (null != connection) {
log.error(qe); response.addException(qe.getBottomQueryException()); throw new DatawaveWebApplicationException(qe, response);
log.error("Error removing job state information", e); response.addException(e.getBottomQueryException()); throw new DatawaveWebApplicationException(e, response);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
} catch (Exception e) { response.addException(new QueryException(e).getBottomQueryException()); throw new DatawaveWebApplicationException(e, response);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
QueryException qe = new QueryException(DatawaveErrorCode.MAPPING_DELETION_ERROR, e); response.addException(qe.getBottomQueryException()); throw new DatawaveWebApplicationException(qe, response); } finally { if (null != writer) { log.error(qe); response.addException(qe); throw new DatawaveWebApplicationException(qe, response);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);
response.addException(qe.getBottomQueryException()); int statusCode = qe.getBottomQueryException().getStatusCode(); throw new DatawaveWebApplicationException(qe, response, statusCode);