Search in sources :

Example 41 with ProtectedApi

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));
    }
}
Also used : CustomScript(io.jans.model.custom.script.model.CustomScript) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 42 with ProtectedApi

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();
}
Also used : CustomScript(io.jans.model.custom.script.model.CustomScript) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 43 with ProtectedApi

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();
}
Also used : Conf(io.jans.as.model.config.Conf) WebKeysConfiguration(io.jans.as.model.config.WebKeysConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 44 with ProtectedApi

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();
}
Also used : Conf(io.jans.as.model.config.Conf) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 45 with ProtectedApi

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();
}
Also used : Scope(io.jans.as.persistence.model.Scope) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Aggregations

ProtectedApi (io.jans.configapi.core.rest.ProtectedApi)52 Client (io.jans.as.common.model.registration.Client)6 Conf (io.jans.as.model.config.Conf)6 Scope (io.jans.as.persistence.model.Scope)5 GluuConfiguration (io.jans.as.persistence.model.configuration.GluuConfiguration)5 GluuAttribute (io.jans.model.GluuAttribute)5 WebKeysConfiguration (io.jans.as.model.config.WebKeysConfiguration)4 UmaResource (io.jans.as.model.uma.persistence.UmaResource)3 SmtpConfiguration (io.jans.model.SmtpConfiguration)3 CustomScript (io.jans.model.custom.script.model.CustomScript)3 AppConfiguration (io.jans.as.model.configuration.AppConfiguration)2 JSONWebKey (io.jans.as.model.jwk.JSONWebKey)2 LicenseResponse (io.jans.ca.plugin.adminui.model.auth.LicenseResponse)2 ApplicationException (io.jans.ca.plugin.adminui.model.exception.ApplicationException)2 ScimAppConfiguration (io.jans.configapi.plugin.scim.model.config.ScimAppConfiguration)2 Properties (java.util.Properties)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 GluuOrganization (io.jans.as.persistence.model.GluuOrganization)1 OAuth2ConfigResponse (io.jans.ca.plugin.adminui.model.auth.OAuth2ConfigResponse)1 AUIConfiguration (io.jans.ca.plugin.adminui.model.config.AUIConfiguration)1