public boolean isPwdResetRequiringSecurityQuestions() { return confDAO.find("passwordReset.securityQuestion", true); }
public boolean isSelfRegAllowed() { return confDAO.find("selfRegistration.allowed", false); }
public boolean isPwdResetAllowed() { return confDAO.find("passwordReset.allowed", false); }
@Transactional(readOnly = true) @Override public long getMaxRetries() { return confDAO.find("notification.maxRetries", 0L); }
@Transactional(readOnly = true) @Override public UserTO returnUserTO(final UserTO userTO) { if (!confDAO.find("return.password.value", false)) { userTO.setPassword(null); } return userTO; }
@PreAuthorize("hasRole('" + StandardEntitlement.CONFIGURATION_DELETE + "')") public void delete(final String schema) { Optional<? extends CPlainAttr> conf = confDAO.find(schema); if (!conf.isPresent()) { PlainSchema plainSchema = plainSchemaDAO.find(schema); if (plainSchema == null) { throw new NotFoundException("Configuration schema " + schema); } } confDAO.delete(schema); }
@PreAuthorize("hasRole('" + StandardEntitlement.CONFIGURATION_GET + "')") @Transactional(readOnly = true) public AttrTO get(final String schema) { AttrTO result; Optional<? extends CPlainAttr> conf = confDAO.find(schema); if (conf.isPresent()) { result = binder.getAttrTO(conf.get()); } else { PlainSchema plainSchema = plainSchemaDAO.find(schema); if (plainSchema == null) { throw new NotFoundException("Configuration schema " + schema); } result = new AttrTO(); result.setSchema(schema); } return result; }
private void setPassword(final User user, final String password, final SyncopeClientCompositeException scce) { try { String algorithm = confDAO.find("password.cipher.algorithm", CipherAlgorithm.AES.name()); user.setPassword(password, CipherAlgorithm.valueOf(algorithm)); } catch (IllegalArgumentException e) { SyncopeClientException invalidCiperAlgorithm = SyncopeClientException.build(ClientExceptionType.NotFound); invalidCiperAlgorithm.getElements().add(e.getMessage()); scce.addException(invalidCiperAlgorithm); throw scce; } }
@PreAuthorize("hasRole('" + StandardEntitlement.REPORT_CREATE + "')") public ReportTO create(final ReportTO reportTO) { Report report = entityFactory.newEntity(Report.class); binder.getReport(report, reportTO); report = reportDAO.save(report); try { jobManager.register( report, null, confDAO.find("tasks.interruptMaxRetries", 1L)); } catch (Exception e) { LOG.error("While registering quartz job for report " + report.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); throw sce; } return binder.getReportTO(report); }
private AccessToken replace( final String subject, final Map<String, Object> claims, final byte[] authorities, final AccessToken accessToken) { Pair<String, Date> generated = generateJWT( accessToken.getKey(), subject, confDAO.find("jwt.lifetime.minutes", 120L), claims); accessToken.setBody(generated.getLeft()); accessToken.setExpiryTime(generated.getRight()); accessToken.setOwner(subject); if (!adminUser.equals(accessToken.getOwner())) { accessToken.setAuthorities(authorities); } return accessTokenDAO.save(accessToken); }
@PreAuthorize("hasRole('" + StandardEntitlement.REPORT_UPDATE + "')") public ReportTO update(final ReportTO reportTO) { Report report = reportDAO.find(reportTO.getKey()); if (report == null) { throw new NotFoundException("Report " + reportTO.getKey()); } binder.getReport(report, reportTO); report = reportDAO.save(report); try { jobManager.register( report, null, confDAO.find("tasks.interruptMaxRetries", 1L)); } catch (Exception e) { LOG.error("While registering quartz job for report " + report.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); throw sce; } return binder.getReportTO(report); }
@PreAuthorize("hasRole('" + StandardEntitlement.TASK_CREATE + "')") public <T extends SchedTaskTO> T createSchedTask(final TaskType type, final T taskTO) { TaskUtils taskUtils = taskUtilsFactory.getInstance(taskTO); if (taskUtils.getType() != type) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest); sce.getElements().add("Found " + type + ", expected " + taskUtils.getType()); throw sce; } SchedTask task = binder.createSchedTask(taskTO, taskUtils); task = taskDAO.save(task); try { jobManager.register( task, task.getStartAt(), confDAO.find("tasks.interruptMaxRetries", 1L)); } catch (Exception e) { LOG.error("While registering quartz job for task " + task.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); throw sce; } return binder.getTaskTO(task, taskUtils, false); }
User user = null; Optional<? extends CPlainAttr> authAttrs = confDAO.find("authentication.attributes"); List<String> authAttrValues = authAttrs.isPresent() ? authAttrs.get().getValuesAsStrings() authenticated = AuthDataAccessor.this.authenticate(user, authentication.getCredentials().toString()); if (authenticated) { if (confDAO.find("log.lastlogindate", true)) { user.setLastLoginDate(new Date()); userModified = true;
User user = null; Optional<? extends CPlainAttr> authAttrs = confDAO.find("authentication.attributes"); List<String> authAttrValues = authAttrs.isPresent() ? authAttrs.get().getValuesAsStrings() authenticated = AuthDataAccessor.this.authenticate(user, authentication.getCredentials().toString()); if (authenticated) { if (confDAO.find("log.lastlogindate", true)) { user.setLastLoginDate(new Date()); userModified = true;
@Override public Pair<String, Date> update(final AccessToken accessToken, final byte[] authorities) { JwsJwtCompactConsumer consumer = new JwsJwtCompactConsumer(accessToken.getBody()); credentialChecker.checkIsDefaultJWSKeyInUse(); long duration = confDAO.find("jwt.lifetime.minutes", 120L); long currentTime = new Date().getTime() / 1000L; long expiry = currentTime + 60L * duration; consumer.getJwtClaims().setExpiryTime(expiry); Date expiryDate = new Date(expiry * 1000L); JwsHeaders jwsHeaders = new JwsHeaders(JoseType.JWT, jwsSignatureProvider.getAlgorithm()); JwtToken token = new JwtToken(jwsHeaders, consumer.getJwtClaims()); JwsJwtCompactProducer producer = new JwsJwtCompactProducer(token); String body = producer.signWith(jwsSignatureProvider); accessToken.setBody(body); // AccessToken stores expiry time in milliseconds, as opposed to seconds for the JWT tokens. accessToken.setExpiryTime(expiryDate); if (!adminUser.equals(accessToken.getOwner())) { accessToken.setAuthorities(authorities); } accessTokenDAO.save(accessToken); return Pair.of(body, expiryDate); }
task, null, confDAO.find("tasks.interruptMaxRetries", 1L));
@PreAuthorize("hasRole('" + StandardEntitlement.TASK_UPDATE + "')") public <T extends SchedTaskTO> T updateSchedTask(final TaskType type, final SchedTaskTO taskTO) { SchedTask task = taskDAO.find(taskTO.getKey()); if (task == null) { throw new NotFoundException("Task " + taskTO.getKey()); } TaskUtils taskUtils = taskUtilsFactory.getInstance(task); if (taskUtils.getType() != type) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest); sce.getElements().add("Found " + type + ", expected " + taskUtils.getType()); throw sce; } binder.updateSchedTask(task, taskTO, taskUtils); task = taskDAO.save(task); try { jobManager.register( task, task.getStartAt(), confDAO.find("tasks.interruptMaxRetries", 1L)); } catch (Exception e) { LOG.error("While registering quartz job for task " + task.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); throw sce; } return binder.getTaskTO(task, taskUtils, false); }
report, startAt, confDAO.find("tasks.interruptMaxRetries", 1L));
(SchedTask) task, startAt, confDAO.find("tasks.interruptMaxRetries", 1L));
long maxHistorySize = confDAO.find("connector.conf.history.size", 10L); if (maxHistorySize < history.size()) {