Search in sources :

Example 51 with ProtectedApi

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

the class JwksResource method getKeyById.

@POST
@ProtectedApi(scopes = { ApiAccessConstants.JWKS_WRITE_ACCESS })
@Path(ApiConstants.KEY_PATH)
public Response getKeyById(@NotNull JSONWebKey jwk) {
    log.debug("Add a new Key to the JWKS = " + jwk);
    Conf conf = configurationService.findConf();
    WebKeysConfiguration webkeys = configurationService.findConf().getWebKeys();
    log.debug("WebKeysConfiguration before addding new key =" + webkeys);
    // x.getKid().equals(jwk.getKid())) ){
    if (getJSONWebKey(webkeys, jwk.getKid()) != null) {
        throw new NotAcceptableException(getNotAcceptableException("JWK with same kid - '" + jwk.getKid() + "' already exists!"));
    }
    // Add key
    webkeys.getKeys().add(jwk);
    conf.setWebKeys(webkeys);
    configurationService.merge(conf);
    webkeys = configurationService.findConf().getWebKeys();
    return Response.status(Response.Status.CREATED).entity(jwk).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 52 with ProtectedApi

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

the class ScimConfigResource method patchAppConfigurationProperty.

@PATCH
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@ProtectedApi(scopes = { "https://jans.io/scim/config.write" })
public Response patchAppConfigurationProperty(@NotNull String requestString) throws IOException, JsonPatchException {
    log.debug("AUTH CONF details to patch - requestString:{}", requestString);
    ScimConf conf = scimConfigService.findConf();
    ScimAppConfiguration appConfiguration = conf.getDynamicConf();
    log.trace("AUTH CONF details BEFORE patch - conf:{}, appConfiguration:{}", conf, appConfiguration);
    appConfiguration = Jackson.applyPatch(requestString, appConfiguration);
    log.trace("AUTH CONF details BEFORE patch merge - appConfiguration:{}", appConfiguration);
    conf.setDynamicConf(appConfiguration);
    scimConfigService.merge(conf);
    appConfiguration = scimConfigService.find();
    log.debug("AUTH CONF details AFTER patch merge - appConfiguration:{}", appConfiguration);
    return Response.ok(appConfiguration).build();
}
Also used : ScimAppConfiguration(io.jans.configapi.plugin.scim.model.config.ScimAppConfiguration) ScimConf(io.jans.configapi.plugin.scim.model.config.ScimConf) 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