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