Search in sources :

Example 16 with ProtectedApi

use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.

the class ConfigSmtpResource method updateSmtpConfiguration.

@PUT
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_WRITE_ACCESS })
public Response updateSmtpConfiguration(@Valid SmtpConfiguration smtpConfiguration) throws EncryptionException {
    log.debug("updateSmtpConfiguration() - 1 - smtpConfiguration = " + smtpConfiguration + "\n\n");
    String password = smtpConfiguration.getPassword();
    if (password != null && !password.isEmpty()) {
        smtpConfiguration.setPassword(encryptionService.encrypt(password));
    }
    log.debug("updateSmtpConfiguration() - 2 - smtpConfiguration = " + smtpConfiguration + "\n\n");
    GluuConfiguration configurationUpdate = configurationService.getConfiguration();
    log.debug("updateSmtpConfiguration() - 1 - configurationUpdate = " + configurationUpdate + "\n\n");
    configurationUpdate.setSmtpConfiguration(smtpConfiguration);
    configurationService.updateConfiguration(configurationUpdate);
    return Response.ok(configurationService.getConfiguration().getSmtpConfiguration()).build();
}
Also used : GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 17 with ProtectedApi

use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.

the class ConfigSmtpResource method removeSmtpConfiguration.

@DELETE
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_DELETE_ACCESS })
public Response removeSmtpConfiguration() {
    GluuConfiguration configurationUpdate = configurationService.getConfiguration();
    configurationUpdate.setSmtpConfiguration(new SmtpConfiguration());
    configurationService.updateConfiguration(configurationUpdate);
    return Response.noContent().build();
}
Also used : SmtpConfiguration(io.jans.model.SmtpConfiguration) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 18 with ProtectedApi

use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.

the class CustomScriptResource method updateScript.

@PUT
@ProtectedApi(scopes = { ApiAccessConstants.SCRIPTS_WRITE_ACCESS })
public Response updateScript(@Valid @NotNull CustomScript customScript) {
    log.debug("CustomScriptResource::updateScript() - customScript = " + customScript + "\n\n");
    CustomScript existingScript = customScriptService.getScriptByInum(customScript.getInum());
    checkResourceNotNull(existingScript, CUSTOM_SCRIPT);
    customScript.setInum(existingScript.getInum());
    customScriptService.update(customScript);
    return Response.ok(customScript).build();
}
Also used : CustomScript(io.jans.model.custom.script.model.CustomScript) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 19 with ProtectedApi

use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.

the class UmaResourcesResource method patchResource.

@PATCH
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@ProtectedApi(scopes = { ApiAccessConstants.UMA_RESOURCES_WRITE_ACCESS })
@Path(ApiConstants.ID_PATH)
public Response patchResource(@PathParam(ApiConstants.ID) @NotNull String id, @NotNull String pathString) throws JsonPatchException, IOException {
    log.debug("UMA_RESOURCE to be patched - id = " + id + " , pathString = " + pathString);
    UmaResource existingResource = findOrThrow(id);
    existingResource = Jackson.applyPatch(pathString, existingResource);
    umaResourceService.updateResource(existingResource);
    return Response.ok(existingResource).build();
}
Also used : UmaResource(io.jans.as.model.uma.persistence.UmaResource) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 20 with ProtectedApi

use of io.jans.configapi.core.rest.ProtectedApi in project jans by JanssenProject.

the class LdapConfigurationResource method patchLdapConfigurationByName.

@PATCH
@Path(ApiConstants.NAME_PARAM_PATH)
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@ProtectedApi(scopes = { ApiAccessConstants.DATABASE_LDAP_WRITE_ACCESS })
public Response patchLdapConfigurationByName(@PathParam(ApiConstants.NAME) String name, @NotNull String requestString) throws JsonPatchException, IOException {
    log.debug("LDAP configuration to be patched - name = " + name + " , requestString = " + requestString);
    GluuLdapConfiguration ldapConfiguration = findLdapConfigurationByName(name);
    log.info("Patch Ldap Configuration by name " + name);
    ldapConfiguration = Jackson.applyPatch(requestString, ldapConfiguration);
    this.ldapConfigurationService.update(ldapConfiguration);
    return Response.ok(ldapConfiguration).build();
}
Also used : GluuLdapConfiguration(io.jans.model.ldap.GluuLdapConfiguration) 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