use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.
the class CustomScriptResource method deleteScript.
@DELETE
@Path(ApiConstants.INUM_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.SCRIPTS_DELETE_ACCESS })
public Response deleteScript(@PathParam(ApiConstants.INUM) @NotNull String inum) {
try {
log.debug("CustomScriptResource::deleteScript() - inum = " + inum + "\n\n");
CustomScript existingScript = customScriptService.getScriptByInum(inum);
customScriptService.remove(existingScript);
return Response.noContent().build();
} catch (Exception ex) {
log.info("Error deleting script by inum " + inum, ex);
throw new NotFoundException(getNotFoundError(CUSTOM_SCRIPT));
}
}
use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.
the class CustomScriptResource method getCustomScriptByInum.
@GET
@Path(PATH_SEPARATOR + ApiConstants.INUM + PATH_SEPARATOR + ApiConstants.INUM_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.SCRIPTS_READ_ACCESS })
public Response getCustomScriptByInum(@PathParam(ApiConstants.INUM) @NotNull String inum) {
log.debug("CustomScript to be fetched - inum = " + inum);
CustomScript script = null;
try {
script = this.customScriptService.getScriptByInum(inum);
} catch (Exception ex) {
ex.printStackTrace();
if (ex.getMessage().contains("Failed to find entry")) {
return Response.status(Response.Status.NOT_FOUND).build();
}
}
return Response.ok(script).build();
}
use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.
the class JwksResource method patch.
@PATCH
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@ProtectedApi(scopes = { ApiAccessConstants.JWKS_WRITE_ACCESS })
public Response patch(String requestString) throws JsonPatchException, IOException {
log.debug("JWKS details to be patched - requestString = " + requestString);
final Conf conf = configurationService.findConf();
WebKeysConfiguration webKeys = conf.getWebKeys();
webKeys = Jackson.applyPatch(requestString, webKeys);
conf.setWebKeys(webKeys);
configurationService.merge(conf);
final String json = configurationService.findConf().getWebKeys().toString();
return Response.ok(json).build();
}
use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.
the class LoggingResource method updateLogConf.
@PUT
@ProtectedApi(scopes = { ApiAccessConstants.LOGGING_WRITE_ACCESS })
public Response updateLogConf(@Valid Logging logging) {
log.debug("LOGGING configuration to be updated -logging = " + logging);
Conf conf = configurationService.findConf();
if (!StringUtils.isBlank(logging.getLoggingLevel())) {
conf.getDynamic().setLoggingLevel(logging.getLoggingLevel());
}
if (!StringUtils.isBlank(logging.getLoggingLayout())) {
conf.getDynamic().setLoggingLayout(logging.getLoggingLayout());
}
conf.getDynamic().setHttpLoggingEnabled(logging.isHttpLoggingEnabled());
conf.getDynamic().setDisableJdkLogger(logging.isDisableJdkLogger());
conf.getDynamic().setEnabledOAuthAuditLogging(logging.isEnabledOAuthAuditLogging());
if (!StringUtils.isBlank(logging.getExternalLoggerConfiguration())) {
conf.getDynamic().setExternalLoggerConfiguration(logging.getExternalLoggerConfiguration());
}
conf.getDynamic().setHttpLoggingExludePaths(logging.getHttpLoggingExludePaths());
configurationService.merge(conf);
logging = this.getLoggingConfiguration();
return Response.ok(logging).build();
}
use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.
the class ScopesResource method deleteScope.
@DELETE
@Path(ApiConstants.INUM_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.SCOPES_DELETE_ACCESS })
public Response deleteScope(@PathParam(ApiConstants.INUM) @NotNull String inum) {
log.debug("SCOPES to be deleted - inum = " + inum);
Scope scope = scopeService.getScopeByInum(inum);
checkResourceNotNull(scope, SCOPE);
scopeService.removeScope(scope);
log.debug("SCOPE is deleted");
return Response.noContent().build();
}
Aggregations