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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations