@Test public void test_toStringYesNo_Boolean() { assertNull(BooleanUtils.toStringYesNo(null)); assertEquals("yes", BooleanUtils.toStringYesNo(Boolean.TRUE)); assertEquals("no", BooleanUtils.toStringYesNo(Boolean.FALSE)); }
@Test public void test_toStringYesNo_boolean() { assertEquals("yes", BooleanUtils.toStringYesNo(true)); assertEquals("no", BooleanUtils.toStringYesNo(false)); }
/** * Sso status response entity. * * @param request the request * @return the response entity */ @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> ssoStatus(final HttpServletRequest request) { val tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request); if (StringUtils.isBlank(tgtId)) { return ResponseEntity.ok(BooleanUtils.toStringYesNo(false)); } val auth = this.ticketRegistrySupport.getAuthenticationFrom(tgtId); return ResponseEntity.ok(BooleanUtils.toStringYesNo(auth != null)); } }
@Override public boolean isSatisfiedBy(final Assertion assertion, final HttpServletRequest request) { LOGGER.trace("Is validation specification set to enforce [{}] protocol behavior? [{}]. Is assertion issued from a new login? [{}]", CasProtocolConstants.PARAMETER_RENEW, BooleanUtils.toStringYesNo(this.renew), BooleanUtils.toStringYesNo(assertion.isFromNewLogin())); var satisfied = isSatisfiedByInternal(assertion); if (!satisfied) { LOGGER.warn("[{}] is not internally satisfied by the produced assertion", getClass().getSimpleName()); return false; } satisfied = !this.renew || assertion.isFromNewLogin(); if (!satisfied) { LOGGER.warn("[{}] is to enforce the [{}] CAS protocol behavior, yet the assertion is not issued from a new login", getClass().getSimpleName(), CasProtocolConstants.PARAMETER_RENEW); return false; } LOGGER.trace("Validation specification is satisfied by the produced assertion"); return true; }
@Override protected Map<String, Object> getAttributesForSamlRegisteredService(final Map<String, Object> attributes, final SamlRegisteredService service, final ApplicationContext applicationContext, final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredServiceServiceProviderMetadataFacade facade, final EntityDescriptor entityDescriptor) { val pattern = RegexUtils.createPattern(this.entityIds); val entityID = entityDescriptor.getEntityID(); val matcher = pattern.matcher(entityID); val matched = fullMatch ? matcher.matches() : matcher.find(); LOGGER.debug("Pattern [{}] matched against [{}]? [{}]", pattern.pattern(), entityID, BooleanUtils.toStringYesNo(matched)); if (matched) { return authorizeReleaseOfAllowedAttributes(attributes); } return new HashMap<>(0); } }
private boolean isRememberMeAuthentication(final RequestContext requestContext) { final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext); final String value = request.getParameter(RememberMeCredential.REQUEST_PARAMETER_REMEMBER_ME); LOGGER.debug("Locating request parameter [{}] with value [{}]", RememberMeCredential.REQUEST_PARAMETER_REMEMBER_ME, value); boolean isRememberMe = StringUtils.isNotBlank(value) && WebUtils.isRememberMeAuthenticationEnabled(requestContext); if (!isRememberMe) { LOGGER.debug("Request does not indicate a remember-me authentication event. Locating authentication object from the request context..."); final Authentication auth = WebUtils.getAuthentication(requestContext); if (auth != null) { final Map<String, Object> attributes = auth.getAttributes(); LOGGER.debug("Located authentication attributes [{}]", attributes); if (attributes.containsKey(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME)) { final Object rememberMeValue = attributes.getOrDefault(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, false); LOGGER.debug("Located remember-me authentication attribute [{}]", rememberMeValue); isRememberMe = CollectionUtils.wrapSet(rememberMeValue).contains(true); } } } LOGGER.debug("Is this request from a remember-me authentication event? [{}]", BooleanUtils.toStringYesNo(isRememberMe)); return isRememberMe; }
StringUtils.capitalize(BooleanUtils.toStringYesNo(latestSem.isStable()))); info.put("Update Availability", updateString);
formatter.format("JVM Maximum Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.maxMemory())); formatter.format("JVM Total Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.totalMemory())); formatter.format("JCE Installed: %s%n", StringUtils.capitalize(BooleanUtils.toStringYesNo(isJceInstalled()))); formatter.format("%s%n", LINE_SEPARATOR);
info.put("JVM Total Memory", FileUtils.byteCountToDisplaySize(runtime.totalMemory())); info.put("JCE Installed", StringUtils.capitalize(BooleanUtils.toStringYesNo(EncodingUtils.isJceInstalled())));
@Override protected void doHealthCheck(final Health.Builder builder) { val samlServices = servicesManager.findServiceBy(registeredService -> registeredService instanceof SamlRegisteredService); val availableResolvers = this.metadataResolutionPlan.getRegisteredMetadataResolvers(); LOGGER.debug("There are [{}] metadata resolver(s) available in the chain", availableResolvers.size()); builder.up(); samlServices.stream() .map(SamlRegisteredService.class::cast) .forEach(service -> availableResolvers .stream() .filter(Objects::nonNull) .forEach(r -> { LOGGER.debug("Evaluating whether metadata resolver [{}] is available for service [{}]", r.getName(), service.getName()); val available = r.isAvailable(service); val map = new HashMap<String, Object>(); map.put("name", service.getName()); map.put("id", service.getId()); map.put("metadataLocation", service.getMetadataLocation()); map.put("serviceId", service.getServiceId()); map.put("availability", BooleanUtils.toStringYesNo(available)); builder.withDetail(service.getName(), map); if (!available) { builder.down(); } })); } }