Search in sources :

Example 36 with ProtectedApi

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

the class AcrsResource method getDefaultAuthenticationMethod.

@GET
@ProtectedApi(scopes = { ApiAccessConstants.ACRS_READ_ACCESS })
public Response getDefaultAuthenticationMethod() {
    final GluuConfiguration gluuConfiguration = configurationService.findGluuConfiguration();
    AuthenticationMethod authenticationMethod = new AuthenticationMethod();
    authenticationMethod.setDefaultAcr(gluuConfiguration.getAuthenticationMode());
    return Response.ok(authenticationMethod).build();
}
Also used : AuthenticationMethod(io.jans.configapi.rest.model.AuthenticationMethod) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 37 with ProtectedApi

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

the class ClientsResource method updateClient.

@PUT
@ProtectedApi(scopes = { ApiAccessConstants.OPENID_CLIENTS_WRITE_ACCESS })
public Response updateClient(@Valid Client client) throws EncryptionException {
    if (logger.isDebugEnabled()) {
        logger.debug("Client details to be updated - client:{}", escapeLog(client));
    }
    String inum = client.getClientId();
    checkNotNull(inum, AttributeNames.INUM);
    checkNotNull(client.getClientName(), AttributeNames.DISPLAY_NAME);
    Client existingClient = clientService.getClientByInum(inum);
    checkResourceNotNull(existingClient, OPENID_CONNECT_CLIENT);
    client.setClientId(existingClient.getClientId());
    client.setBaseDn(clientService.getDnForClient(inum));
    client.setDeletable(client.getExpirationDate() != null);
    if (client.getClientSecret() != null) {
        client.setClientSecret(encryptionService.encrypt(client.getClientSecret()));
    }
    clientService.updateClient(client);
    Client result = clientService.getClientByInum(existingClient.getClientId());
    result.setClientSecret(encryptionService.decrypt(client.getClientSecret()));
    return Response.ok(result).build();
}
Also used : Client(io.jans.as.common.model.registration.Client) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 38 with ProtectedApi

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

the class ClientsResource method deleteClient.

@DELETE
@Path(ApiConstants.INUM_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.OPENID_CLIENTS_DELETE_ACCESS })
public Response deleteClient(@PathParam(ApiConstants.INUM) @NotNull String inum) {
    if (logger.isDebugEnabled()) {
        logger.debug("Client to be deleted - inum:{} ", escapeLog(inum));
    }
    Client client = clientService.getClientByInum(inum);
    checkResourceNotNull(client, OPENID_CONNECT_CLIENT);
    clientService.removeClient(client);
    return Response.noContent().build();
}
Also used : Client(io.jans.as.common.model.registration.Client) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 39 with ProtectedApi

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

the class ConfigSmtpResource method getSmtpServerConfiguration.

@GET
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_READ_ACCESS })
public Response getSmtpServerConfiguration() {
    SmtpConfiguration smtpConfiguration = configurationService.getConfiguration().getSmtpConfiguration();
    log.debug("getSmtpServerConfiguration() - smtpConfiguration = " + smtpConfiguration + "\n\n");
    return Response.ok(Objects.requireNonNullElseGet(smtpConfiguration, SmtpConfiguration::new)).build();
}
Also used : SmtpConfiguration(io.jans.model.SmtpConfiguration) ProtectedApi(io.jans.configapi.core.rest.ProtectedApi)

Example 40 with ProtectedApi

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

the class ConfigSmtpResource method testSmtpConfiguration.

@POST
@Path(ApiConstants.TEST)
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_READ_ACCESS })
public Response testSmtpConfiguration() throws EncryptionException {
    log.debug("\n ConfigSmtpResource::testSmtpConfiguration() - 1 - \n\n");
    SmtpConfiguration smtpConfiguration = configurationService.getConfiguration().getSmtpConfiguration();
    log.debug("\n ConfigSmtpResource::testSmtpConfiguration() - 1 - smtpConfiguration = " + smtpConfiguration + "\n\n");
    smtpConfiguration.setPasswordDecrypted(encryptionService.decrypt(smtpConfiguration.getPassword()));
    boolean status = mailService.sendMail(smtpConfiguration, smtpConfiguration.getFromEmailAddress(), smtpConfiguration.getFromName(), smtpConfiguration.getFromEmailAddress(), null, "SMTP Configuration verification", "Mail to test smtp configuration", "Mail to test smtp configuration");
    log.debug("\n ConfigSmtpResource::testSmtpConfiguration() - 2 - status = " + status + "\n\n");
    return Response.ok(status).build();
}
Also used : SmtpConfiguration(io.jans.model.SmtpConfiguration) 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