Search in sources :

Example 31 with ProtectedApi

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

the class AttributesResource method getAttributeByInum.

@GET
@ProtectedApi(scopes = { ApiAccessConstants.ATTRIBUTES_READ_ACCESS })
@Path(ApiConstants.INUM_PATH)
public Response getAttributeByInum(@PathParam(ApiConstants.INUM) @NotNull String inum) {
    GluuAttribute attribute = attributeService.getAttributeByInum(inum);
    checkResourceNotNull(attribute, GLUU_ATTRIBUTE);
    return Response.ok(attribute).build();
}
Also used : GluuAttribute(io.jans.model.GluuAttribute) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 32 with ProtectedApi

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

the class AttributesResource method updateAttribute.

@PUT
@ProtectedApi(scopes = { ApiAccessConstants.ATTRIBUTES_WRITE_ACCESS })
public Response updateAttribute(@Valid GluuAttribute attribute) {
    log.debug(" GluuAttribute details to update - attribute = " + attribute);
    String inum = attribute.getInum();
    checkResourceNotNull(inum, GLUU_ATTRIBUTE);
    checkNotNull(attribute.getName(), AttributeNames.NAME);
    checkNotNull(attribute.getDisplayName(), AttributeNames.DISPLAY_NAME);
    checkResourceNotNull(attribute.getDataType(), AttributeNames.DATA_TYPE);
    GluuAttribute existingAttribute = attributeService.getAttributeByInum(inum);
    checkResourceNotNull(existingAttribute, GLUU_ATTRIBUTE);
    attribute.setInum(existingAttribute.getInum());
    attribute.setBaseDn(attributeService.getDnForAttribute(inum));
    attributeService.updateAttribute(attribute);
    GluuAttribute result = attributeService.getAttributeByInum(inum);
    return Response.ok(result).build();
}
Also used : GluuAttribute(io.jans.model.GluuAttribute) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 33 with ProtectedApi

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

the class AttributesResource method createAttribute.

@POST
@ProtectedApi(scopes = { ApiAccessConstants.ATTRIBUTES_WRITE_ACCESS })
public Response createAttribute(@Valid GluuAttribute attribute) {
    log.debug(" GluuAttribute details to add - attribute = " + attribute);
    checkNotNull(attribute.getName(), AttributeNames.NAME);
    checkNotNull(attribute.getDisplayName(), AttributeNames.DISPLAY_NAME);
    checkResourceNotNull(attribute.getDataType(), AttributeNames.DATA_TYPE);
    String inum = attributeService.generateInumForNewAttribute();
    attribute.setInum(inum);
    attribute.setDn(attributeService.getDnForAttribute(inum));
    attributeService.addAttribute(attribute);
    GluuAttribute result = attributeService.getAttributeByInum(inum);
    return Response.status(Response.Status.CREATED).entity(result).build();
}
Also used : GluuAttribute(io.jans.model.GluuAttribute) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 34 with ProtectedApi

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

the class ConfigResource method getPersistenceDetails.

@GET
@ProtectedApi(scopes = { ApiAccessConstants.JANS_AUTH_CONFIG_READ_ACCESS })
@Path(ApiConstants.PERSISTENCE)
public Response getPersistenceDetails() {
    String persistenceType = configurationService.getPersistenceType();
    log.debug("ConfigResource::getPersistenceDetails() - persistenceType - " + persistenceType);
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("persistenceType", persistenceType);
    log.debug("\n\n\n ConfigResource::getPersistenceDetails() - jsonObject = " + jsonObject + "\n\n");
    return Response.ok(jsonObject.toString()).build();
}
Also used : JSONObject(org.json.JSONObject) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 35 with ProtectedApi

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

the class ConfigResource method patchAppConfigurationProperty.

@PATCH
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@ProtectedApi(scopes = { ApiAccessConstants.JANS_AUTH_CONFIG_WRITE_ACCESS })
public Response patchAppConfigurationProperty(@NotNull String requestString) throws Exception {
    log.debug("AUTH CONF details to patch - requestString = " + requestString);
    Conf conf = configurationService.findConf();
    AppConfiguration appConfiguration = configurationService.find();
    log.debug("AUTH CONF details BEFORE patch - appConfiguration = " + appConfiguration);
    appConfiguration = Jackson.applyPatch(requestString, conf.getDynamic());
    log.debug("AUTH CONF details BEFORE patch merge - appConfiguration = " + appConfiguration);
    conf.setDynamic(appConfiguration);
    configurationService.merge(conf);
    appConfiguration = configurationService.find();
    log.debug("AUTH CONF details AFTER patch merge - appConfiguration = " + appConfiguration);
    return Response.ok(appConfiguration).build();
}
Also used : Conf(io.jans.as.model.config.Conf) AppConfiguration(io.jans.as.model.configuration.AppConfiguration) 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