Search in sources :

Example 11 with GluuConfiguration

use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.

the class StatusCheckerDaily method processInt.

/**
 * Gather periodically site and server status
 *
 * @param when
 *            Date
 * @param interval
 *            Interval
 */
private void processInt() {
    log.debug("Starting daily status checker");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    if (!appConfiguration.isUpdateStatus()) {
        return;
    }
    log.debug("Getting data from ldap");
    GluuConfiguration configuration = configurationService.getConfiguration();
    GluuOxTrustStat oxTrustStat = configurationService.getOxtrustStat();
    oxTrustStat.setGroupCount(String.valueOf(groupService.countGroups()));
    oxTrustStat.setPersonCount(String.valueOf(personService.countPersons()));
    Date currentDateTime = new Date();
    configuration.setLastUpdate(currentDateTime);
    configurationService.updateConfiguration(configuration);
    configurationService.updateOxtrustStat(oxTrustStat);
    log.debug("Daily Configuration status update finished");
}
Also used : AppConfiguration(org.gluu.config.oxtrust.AppConfiguration) GluuOxTrustStat(org.gluu.oxtrust.model.GluuOxTrustStat) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) Date(java.util.Date)

Example 12 with GluuConfiguration

use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.

the class AuthenticationMethodWebResource method getCurrentAuthentication.

@GET
@Operation(summary = "Get current authentication methods", description = "Get current authentication methods")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AuthenticationMethod.class)), description = Constants.RESULT_SUCCESS), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response getCurrentAuthentication() {
    log(logger, "Processing getCurrentAuthentication()");
    try {
        GluuConfiguration configuration = configurationService.getConfiguration();
        AuthenticationMethod method = new AuthenticationMethod();
        method.setDefaultAcr(configuration.getAuthenticationMode());
        method.setOxtrustAcr(configuration.getOxTrustAuthenticationMode());
        return Response.ok(method).build();
    } catch (Exception e) {
        log(logger, e);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}
Also used : AuthenticationMethod(org.gluu.oxtrust.api.server.model.AuthenticationMethod) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) GET(javax.ws.rs.GET) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 13 with GluuConfiguration

use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.

the class OxtrustSettingWebResource method updateOxtrustSetting.

@PUT
@Operation(summary = "Update oxtrust settings", description = "Update oxtrust settings")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = OxtrustSetting.class)), description = Constants.RESULT_SUCCESS), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response updateOxtrustSetting(OxtrustSetting oxtrustSetting) {
    try {
        log(logger, "Processing oxtrust settings update request");
        Preconditions.checkNotNull(oxtrustSetting, "Attempt to update null oxtrust settings");
        GluuConfiguration configurationUpdate = configurationService.getConfiguration();
        configurationUpdate.setScimEnabled(Boolean.valueOf(oxtrustSetting.getEnableScim()));
        configurationUpdate.setPassportEnabled(Boolean.valueOf(oxtrustSetting.getEnablePassport()));
        configurationUpdate.setPasswordResetAllowed(Boolean.valueOf(oxtrustSetting.getAllowPasswordReset()));
        configurationUpdate.setProfileManagment(Boolean.valueOf(oxtrustSetting.getAllowProfileManagement()));
        configurationService.updateConfiguration(configurationUpdate);
        return Response.ok(Constants.RESULT_SUCCESS).build();
    } catch (Exception e) {
        log(logger, e);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}
Also used : GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi) Operation(io.swagger.v3.oas.annotations.Operation) PUT(javax.ws.rs.PUT) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 14 with GluuConfiguration

use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.

the class OxtrustSettingWebResource method getOxtrustSettings.

@GET
@Operation(summary = "Get oxtrust settings", description = "Get oxtrust settings")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = OxtrustSetting.class)), description = Constants.RESULT_SUCCESS), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response getOxtrustSettings() {
    try {
        log(logger, "Processing oxtrust settings retrieval request");
        GluuConfiguration configurationUpdate = configurationService.getConfiguration();
        OxtrustSetting setting = new OxtrustSetting();
        setting.setAllowPasswordReset(String.valueOf(configurationUpdate.isPasswordResetAllowed()));
        setting.setAllowProfileManagement(String.valueOf(configurationUpdate.isProfileManagment()));
        setting.setEnablePassport(String.valueOf(configurationUpdate.isPassportEnabled()));
        setting.setEnableScim(String.valueOf(configurationUpdate.isScimEnabled()));
        return Response.ok(setting).build();
    } catch (Exception e) {
        log(logger, e);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
}
Also used : OxtrustSetting(org.gluu.oxtrust.api.server.model.OxtrustSetting) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) GET(javax.ws.rs.GET) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 15 with GluuConfiguration

use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationService method saveOxMemCacheConfiguration.

public boolean saveOxMemCacheConfiguration(CacheConfiguration cachedConfiguration) {
    encrypPassword(cachedConfiguration.getRedisConfiguration());
    GluuConfiguration gluuConfiguration = configurationService.getConfiguration();
    gluuConfiguration.setCacheConfiguration(cachedConfiguration);
    configurationService.updateConfiguration(gluuConfiguration);
    return true;
}
Also used : GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration)

Aggregations

GluuConfiguration (org.gluu.oxtrust.model.GluuConfiguration)32 Date (java.util.Date)8 IOException (java.io.IOException)6 BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)6 Operation (io.swagger.v3.oas.annotations.Operation)5 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)5 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)5 TrustStoreCertificate (org.gluu.oxtrust.model.cert.TrustStoreCertificate)4 Parameters (org.testng.annotations.Parameters)3 Test (org.testng.annotations.Test)3 X509Certificate (java.security.cert.X509Certificate)2 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 PUT (javax.ws.rs.PUT)2 AppConfiguration (org.gluu.config.oxtrust.AppConfiguration)2 SmtpConfiguration (org.gluu.model.SmtpConfiguration)2 GluuOxTrustStat (org.gluu.oxtrust.model.GluuOxTrustStat)2 TrustStoreConfiguration (org.gluu.oxtrust.model.cert.TrustStoreConfiguration)2 X509CertificateShortInfo (org.gluu.oxtrust.util.X509CertificateShortInfo)2 File (java.io.File)1