@Bean @RefreshScope public WsFederationConfiguration wsFedConfig() { final WsFederationConfiguration config = new WsFederationConfiguration(); final WsFederationProperties wsfed = casProperties.getAuthn().getWsfed(); config.setAttributesType( WsFederationConfiguration.WsFedPrincipalResolutionAttributesType.valueOf( wsfed.getAttributesType())); config.setIdentityAttribute(wsfed.getIdentityAttribute()); config.setIdentityProviderIdentifier(wsfed.getIdentityProviderIdentifier()); config.setIdentityProviderUrl(wsfed.getIdentityProviderUrl()); config.setTolerance(wsfed.getTolerance()); config.setRelyingPartyIdentifier(wsfed.getRelyingPartyIdentifier()); org.springframework.util.StringUtils.commaDelimitedListToSet( wsfed.getSigningCertificateResources()) .forEach( s -> config.getSigningCertificateResources().add(this.resourceLoader.getResource(s))); org.springframework.util.StringUtils.commaDelimitedListToSet(wsfed.getEncryptionPrivateKey()) .forEach(s -> config.setEncryptionPrivateKey(this.resourceLoader.getResource(s))); org.springframework.util.StringUtils.commaDelimitedListToSet(wsfed.getEncryptionCertificate()) .forEach(s -> config.setEncryptionCertificate(this.resourceLoader.getResource(s))); config.setEncryptionPrivateKeyPassword(wsfed.getEncryptionPrivateKeyPassword()); config.setAttributeMutator(this.attributeMutator); return config; }
public ClientDetails mapRow(ResultSet rs, int rowNum) throws SQLException { BaseClientDetails details = new BaseClientDetails( rs.getString(1), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(7), rs.getString(6)); details.setClientSecret(rs.getString(2)); if (rs.getObject(8) != null) { details.setAccessTokenValiditySeconds(rs.getInt(8)); } if (rs.getObject(9) != null) { details.setRefreshTokenValiditySeconds(rs.getInt(9)); } String json = rs.getString(10); if (json != null) { try { @SuppressWarnings("unchecked") Map<String, Object> additionalInformation = mapper.read(json, Map.class); details.setAdditionalInformation(additionalInformation); } catch (Exception e) { logger.warn("Could not decode JSON for additional information: " + details, e); } } String scopes = rs.getString(11); if (scopes != null) { details.setAutoApproveScopes(StringUtils.commaDelimitedListToSet(scopes)); } return details; }
/** * Returns an html page valid for printing * * <p> * * @param obj instance to print. * @return html text strem * @throws ObjectNotFoundException If specified object could not be found. * @throws SendFailedException */ @PreAuthorize("hasRole('ROLE_PERSON_READ') or hasRole('ROLE_PERSON_MAP_READ')") @RequestMapping(value = "/emailCurrent", method = RequestMethod.POST) public @ResponseBody String email( final HttpServletResponse response, final @PathVariable UUID personId, @RequestBody final PlanOutputTO planOutputDataTO) throws ObjectNotFoundException { Plan currentPlan = service.getCurrentForStudent(personId); PlanTO planTO = getFactory().from(currentPlan); planOutputDataTO.setPlan(planTO); SubjectAndBody messageText = service.createOutput(planOutputDataTO); if (messageText == null) return null; Person person = personService.get(UUID.fromString(planOutputDataTO.getPlan().getPersonId())); Set<String> watcherAddresses = new HashSet<String>(person.getWatcherEmailAddresses()); watcherAddresses.addAll( org.springframework.util.StringUtils.commaDelimitedListToSet( planOutputDataTO.getEmailCC())); messageService.createMessage( planOutputDataTO.getEmailTo(), org.springframework.util.StringUtils.arrayToCommaDelimitedString( watcherAddresses.toArray(new String[watcherAddresses.size()])), messageText); return "Map Plan has been queued."; }
@RequestMapping(value = "/select-suggested-address", method = RequestMethod.POST) public String doSelectSuggestedAddress( final AddressForm addressForm, final RedirectAttributes redirectModel) { final Set<String> resolveCountryRegions = org.springframework.util.StringUtils.commaDelimitedListToSet( Config.getParameter("resolve.country.regions")); final AddressData selectedAddress = new AddressData(); selectedAddress.setId(addressForm.getAddressId()); selectedAddress.setTitleCode(addressForm.getTitleCode()); selectedAddress.setFirstName(addressForm.getFirstName()); selectedAddress.setLastName(addressForm.getLastName()); selectedAddress.setLine1(addressForm.getLine1()); selectedAddress.setLine2(addressForm.getLine2()); selectedAddress.setTown(addressForm.getTownCity()); selectedAddress.setPostalCode(addressForm.getPostcode()); selectedAddress.setBillingAddress(false); selectedAddress.setShippingAddress(true); selectedAddress.setVisibleInAddressBook(true); final CountryData countryData = i18NFacade.getCountryForIsocode(addressForm.getCountryIso()); selectedAddress.setCountry(countryData); if (resolveCountryRegions.contains(countryData.getIsocode())) { if (addressForm.getRegionIso() != null && !StringUtils.isEmpty(addressForm.getRegionIso())) { final RegionData regionData = getI18NFacade().getRegion(addressForm.getCountryIso(), addressForm.getRegionIso()); selectedAddress.setRegion(regionData); } } if (resolveCountryRegions.contains(countryData.getIsocode())) { if (addressForm.getRegionIso() != null && !StringUtils.isEmpty(addressForm.getRegionIso())) { final RegionData regionData = getI18NFacade().getRegion(addressForm.getCountryIso(), addressForm.getRegionIso()); selectedAddress.setRegion(regionData); } } if (Boolean.TRUE.equals(addressForm.getEditAddress())) { selectedAddress.setDefaultAddress( Boolean.TRUE.equals(addressForm.getDefaultAddress()) || userFacade.getAddressBook().size() <= 1); userFacade.editAddress(selectedAddress); } else { selectedAddress.setDefaultAddress( Boolean.TRUE.equals(addressForm.getDefaultAddress()) || userFacade.isAddressBookEmpty()); userFacade.addAddress(selectedAddress); } GlobalMessages.addFlashMessage( redirectModel, GlobalMessages.CONF_MESSAGES_HOLDER, "account.confirmation.address.added"); return REDIRECT_TO_ADDRESS_BOOK_PAGE; }
protected boolean isCSRFExemptUrl(final String servletPath) { if (servletPath != null) { final String allowedUrlPatterns = Config.getParameter(CSRF_ALLOWED_URLS); final Set<String> allowedUrls = StringUtils.commaDelimitedListToSet(allowedUrlPatterns); for (final String pattern : allowedUrls) { if (servletPath.matches(pattern)) { return true; } } } return false; }
public BaseClientDetails( String clientId, String resourceIds, String scopes, String grantTypes, String authorities, String redirectUris) { this.clientId = clientId; if (StringUtils.hasText(resourceIds)) { Set<String> resources = StringUtils.commaDelimitedListToSet(resourceIds); if (!resources.isEmpty()) { this.resourceIds = resources; } } if (StringUtils.hasText(scopes)) { Set<String> scopeList = StringUtils.commaDelimitedListToSet(scopes); if (!scopeList.isEmpty()) { this.scope = scopeList; } } if (StringUtils.hasText(grantTypes)) { this.authorizedGrantTypes = StringUtils.commaDelimitedListToSet(grantTypes); } else { this.authorizedGrantTypes = new HashSet<String>(Arrays.asList("authorization_code", "refresh_token")); } if (StringUtils.hasText(authorities)) { this.authorities = AuthorityUtils.commaSeparatedStringToAuthorityList(authorities); } if (StringUtils.hasText(redirectUris)) { this.registeredRedirectUris = StringUtils.commaDelimitedListToSet(redirectUris); } }
@SuppressWarnings("unchecked") private List<ApplicationListener<ApplicationEvent>> getListeners(ConfigurableEnvironment env) { String classNames = env.getProperty(PROPERTY_NAME); List<ApplicationListener<ApplicationEvent>> listeners = new ArrayList<ApplicationListener<ApplicationEvent>>(); if (StringUtils.hasLength(classNames)) { for (String className : StringUtils.commaDelimitedListToSet(classNames)) { try { Class<?> clazz = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader()); Assert.isAssignable( ApplicationListener.class, clazz, "class [" + className + "] must implement ApplicationListener"); listeners.add((ApplicationListener<ApplicationEvent>) BeanUtils.instantiateClass(clazz)); } catch (Exception ex) { throw new ApplicationContextException( "Failed to load context listener class [" + className + "]", ex); } } } AnnotationAwareOrderComparator.sort(listeners); return listeners; }
public Set<String> getAcceptVersion() { String rawValue = getFirstNativeHeader(STOMP_ACCEPT_VERSION_HEADER); return (rawValue != null) ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.<String>emptySet(); }