Search in sources :

Example 26 with ProtectedApi

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

the class SqlConfigurationResource method test.

@POST
@Path(ApiConstants.TEST)
@ProtectedApi(scopes = { ApiAccessConstants.DATABASE_SQL_READ_ACCESS })
public Response test(@Valid @NotNull SqlConnectionConfiguration conf) {
    log.debug("SQL to be tested - conf = " + conf);
    Properties properties = new Properties();
    properties.put("sql.db.schema.name", conf.getSchemaName());
    properties.put("sql.connection.uri", Joiner.on(",").join(conf.getConnectionUri()));
    properties.put("sql.connection.driver-property.serverTimezone", conf.getServerTimezone());
    properties.put("sql.connection.pool.max-total", conf.getConnectionPoolMaxTotal());
    properties.put("sql.connection.pool.max-idle", conf.getConnectionPoolMaxIdle());
    properties.put("sql.auth.userName", conf.getUserName());
    properties.put("sql.auth.userPassword", conf.getUserPassword());
    // Password hash method
    properties.put("sql.password.encryption.method", conf.getPasswordEncryptionMethod());
    // Max time needed to create connection pool in milliseconds
    properties.put("sql.connection.pool.create-max-wait-time-millis", conf.getCreateMaxWaitTimeMillis());
    // Max wait 20 seconds
    properties.put("sql.connection.pool.max-wait-time-millis", conf.getMaxWaitTimeMillis());
    // Allow to evict connection in pool after 30 minutes
    properties.put("sql.connection.pool.min-evictable-idle-time-millis", conf.getMinEvictableIdleTimeMillis());
    properties.put("sql.binaryAttributes", Joiner.on(",").join(conf.getBinaryAttributes()));
    properties.put("sql.certificateAttributes", Joiner.on(",").join(conf.getCertificateAttributes()));
    SqlConnectionProvider connectionProvider = new SqlConnectionProvider(properties);
    return Response.ok(connectionProvider.isConnected()).build();
}
Also used : SqlConnectionProvider(io.jans.orm.sql.operation.impl.SqlConnectionProvider) Properties(java.util.Properties) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 27 with ProtectedApi

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

the class StatResource method getStatistics.

@GET
@ProtectedApi(scopes = { ApiAccessConstants.STATS_USER_READ_ACCESS, ApiAccessConstants.JANS_STAT })
@Produces(MediaType.APPLICATION_JSON)
public Response getStatistics(@HeaderParam("Authorization") String authorization, @QueryParam(value = "month") String month, @QueryParam(value = "format") String format) {
    if (StringUtils.isBlank(format)) {
        format = "";
    }
    String url = getIssuer() + this.statUrl;
    JsonNode jsonNode = this.authService.getStat(url, authorization, month, format);
    logger.trace("StatResource::getUserStatistics() - jsonNode:{} ", jsonNode);
    return Response.ok(jsonNode.get("response")).build();
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 28 with ProtectedApi

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

the class UmaResourcesResource method deleteUmaResource.

@DELETE
@Path(ApiConstants.ID_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.UMA_RESOURCES_DELETE_ACCESS })
public Response deleteUmaResource(@PathParam(value = ApiConstants.ID) @NotNull String id) {
    log.debug("UMA_RESOURCE to delete - id = " + id);
    UmaResource umaResource = findOrThrow(id);
    umaResourceService.remove(umaResource);
    return Response.status(Response.Status.NO_CONTENT).build();
}
Also used : UmaResource(io.jans.as.model.uma.persistence.UmaResource) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 29 with ProtectedApi

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

the class UmaResourcesResource method updateUmaResource.

@PUT
@ProtectedApi(scopes = { ApiAccessConstants.UMA_RESOURCES_WRITE_ACCESS })
public Response updateUmaResource(@Valid UmaResource resource) {
    log.debug("UMA_RESOURCE to be upated - umaResource = " + resource);
    String id = resource.getId();
    checkNotNull(id, AttributeNames.ID);
    UmaResource existingResource = findOrThrow(id);
    resource.setId(existingResource.getId());
    resource.setDn(umaResourceService.getDnForResource(id));
    umaResourceService.updateResource(resource);
    return Response.ok(resource).build();
}
Also used : UmaResource(io.jans.as.model.uma.persistence.UmaResource) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 30 with ProtectedApi

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

the class AttributesResource method deleteAttribute.

@DELETE
@Path(ApiConstants.INUM_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.ATTRIBUTES_DELETE_ACCESS })
public Response deleteAttribute(@PathParam(ApiConstants.INUM) @NotNull String inum) {
    log.debug(" GluuAttribute details to delete - inum = " + inum);
    GluuAttribute attribute = attributeService.getAttributeByInum(inum);
    checkResourceNotNull(attribute, GLUU_ATTRIBUTE);
    attributeService.removeAttribute(attribute);
    return Response.noContent().build();
}
Also used : GluuAttribute(io.jans.model.GluuAttribute) 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