Search in sources :

Example 1 with ProtectedApi

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

the class OAuth2Resource method getOAuth2Config.

@GET
@Path(OAUTH2_CONFIG)
@Produces(MediaType.APPLICATION_JSON)
@ProtectedApi(scopes = { SCOPE_OPENID })
public Response getOAuth2Config() {
    AUIConfiguration auiConfiguration = auiConfigurationService.getAUIConfiguration();
    OAuth2ConfigResponse oauth2Config = new OAuth2ConfigResponse();
    oauth2Config.setAuthzBaseUrl(auiConfiguration.getAuthServerAuthzBaseUrl());
    oauth2Config.setClientId(auiConfiguration.getAuthServerClientId());
    oauth2Config.setResponseType("code");
    oauth2Config.setScope(auiConfiguration.getAuthServerScope());
    oauth2Config.setRedirectUrl(auiConfiguration.getAuthServerRedirectUrl());
    oauth2Config.setAcrValues("simple_password_auth");
    oauth2Config.setFrontChannelLogoutUrl(auiConfiguration.getAuthServerFrontChannelLogoutUrl());
    oauth2Config.setPostLogoutRedirectUri(auiConfiguration.getAuthServerPostLogoutRedirectUri());
    oauth2Config.setEndSessionEndpoint(auiConfiguration.getAuthServerEndSessionEndpoint());
    return Response.ok(oauth2Config).build();
}
Also used : OAuth2ConfigResponse(io.jans.ca.plugin.adminui.model.auth.OAuth2ConfigResponse) AUIConfiguration(io.jans.ca.plugin.adminui.model.config.AUIConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 2 with ProtectedApi

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

the class LicenseResource method getLicenseDetails.

@GET
@Path(LICENSE_DETAILS)
@ProtectedApi(scopes = { SCOPE_LICENSE_READ })
@Produces(MediaType.APPLICATION_JSON)
public Response getLicenseDetails() {
    try {
        log.info("Trying to fetch license details.");
        LicenseResponse licenseResponse = licenseDetailsService.getLicenseDetails();
        return Response.ok(licenseResponse).build();
    } catch (Exception e) {
        log.error(ErrorResponse.GET_LICENSE_DETAILS_ERROR.getDescription(), e);
        return Response.serverError().entity(ErrorResponse.GET_LICENSE_DETAILS_ERROR.getDescription()).build();
    }
}
Also used : LicenseResponse(io.jans.ca.plugin.adminui.model.auth.LicenseResponse) ApplicationException(io.jans.ca.plugin.adminui.model.exception.ApplicationException) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 3 with ProtectedApi

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

the class AttributesResource method patchAtribute.

@PATCH
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@ProtectedApi(scopes = { ApiAccessConstants.ATTRIBUTES_WRITE_ACCESS })
@Path(ApiConstants.INUM_PATH)
public Response patchAtribute(@PathParam(ApiConstants.INUM) @NotNull String inum, @NotNull String pathString) throws JsonPatchException, IOException {
    log.debug(" GluuAttribute details to patch - inum = " + inum + " , pathString = " + pathString);
    GluuAttribute existingAttribute = attributeService.getAttributeByInum(inum);
    checkResourceNotNull(existingAttribute, GLUU_ATTRIBUTE);
    existingAttribute = Jackson.applyPatch(pathString, existingAttribute);
    attributeService.updateAttribute(existingAttribute);
    return Response.ok(existingAttribute).build();
}
Also used : GluuAttribute(io.jans.model.GluuAttribute) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 4 with ProtectedApi

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

the class ConfigResource method getAppConfiguration.

@GET
@ProtectedApi(scopes = { ApiAccessConstants.JANS_AUTH_CONFIG_READ_ACCESS })
public Response getAppConfiguration() {
    AppConfiguration appConfiguration = configurationService.find();
    log.debug("ConfigResource::getAppConfiguration() appConfiguration - " + appConfiguration);
    return Response.ok(appConfiguration).build();
}
Also used : AppConfiguration(io.jans.as.model.configuration.AppConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 5 with ProtectedApi

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

the class JwksResource method deleteKey.

@DELETE
@ProtectedApi(scopes = { ApiAccessConstants.JWKS_WRITE_ACCESS })
@Path(ApiConstants.KID_PATH)
public Response deleteKey(@PathParam(ApiConstants.KID) @NotNull String kid) {
    log.debug("Key to be to be deleted - kid = " + kid);
    final Conf conf = configurationService.findConf();
    WebKeysConfiguration webkeys = configurationService.findConf().getWebKeys();
    JSONWebKey jwk = getJSONWebKey(webkeys, kid);
    if (jwk == null) {
        throw new NotFoundException(getNotFoundError("JWK with kid - '" + kid + "' does not exist!"));
    }
    conf.getWebKeys().getKeys().removeIf(x -> x.getKid() != null && x.getKid().equals(kid));
    configurationService.merge(conf);
    return Response.noContent().build();
}
Also used : JSONWebKey(io.jans.as.model.jwk.JSONWebKey) Conf(io.jans.as.model.config.Conf) WebKeysConfiguration(io.jans.as.model.config.WebKeysConfiguration) 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