/** * Instantiates a new argument extractor. * * @param serviceFactory the service factory */ public DefaultArgumentExtractor(final ServiceFactory<? extends WebApplicationService> serviceFactory) { super(CollectionUtils.wrapList(serviceFactory)); }
@Override public X509Certificate[] getAcceptedIssuers() { val certificates = new ArrayList<X509Certificate>(); this.trustManagers.forEach(trustManager -> certificates.addAll(CollectionUtils.wrapList(trustManager.getAcceptedIssuers()))); return certificates.toArray(X509Certificate[]::new); } }
@Override public String[] getClientAliases(final String keyType, final Principal[] issuers) { val aliases = new ArrayList<String>(); this.keyManagers.forEach(keyManager -> aliases.addAll(CollectionUtils.wrapList(keyManager.getClientAliases(keyType, issuers)))); return aliases.toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
@Override public String[] getServerAliases(final String keyType, final Principal[] issuers) { val aliases = new ArrayList<String>(); this.keyManagers.forEach(keyManager -> aliases.addAll(CollectionUtils.wrapList(keyManager.getServerAliases(keyType, issuers)))); return aliases.toArray(ArrayUtils.EMPTY_STRING_ARRAY); } }
/** * sets the signing certs. * * @param signingCertificateResources a list of certificate files to read in. */ public void setSigningCertificateResources(final Resource... signingCertificateResources) { this.signingCertificateResources = CollectionUtils.wrapList(signingCertificateResources); createSigningWallet(this.signingCertificateResources); }
/** * As multi value map. * * @param key1 the key 1 * @param value1 the value 1 * @param key2 the key 2 * @param value2 the value 2 * @return the multi value map */ public static MultiValueMap asMultiValueMap(final String key1, final Object value1, final String key2, final Object value2) { val wrap = (Map) wrap(key1, wrapList(value1), key2, wrapList(value2)); return org.springframework.util.CollectionUtils.toMultiValueMap(wrap); }
/** * Load a collection of specified objects from the stream. * * @param stream the stream * @return the collection */ default Collection<T> load(final InputStream stream) { val result = from(stream); if (result != null) { return CollectionUtils.wrapList(result); } return new ArrayList<>(0); }
public ResourceCRLRevocationChecker(final Resource[] crl, final RevocationPolicy<X509CRL> expiredCRLPolicy) { this(false, null, expiredCRLPolicy, DEFAULT_REFRESH_INTERVAL, new ResourceCRLFetcher(), CollectionUtils.wrapList(crl)); }
/** * Load collection. * * @param stream the stream * @return the collection */ default Collection<T> load(final Reader stream) { val result = from(stream); if (result != null) { return CollectionUtils.wrapList(result); } return new ArrayList<>(0); }
@Override public Set<AuthenticationHandler> getAuthenticationHandlers() { val handlers = authenticationHandlerPrincipalResolverMap.keySet().toArray(AuthenticationHandler[]::new); OrderComparator.sortIfNecessary(handlers); return new LinkedHashSet<>(CollectionUtils.wrapList(handlers)); }
public ResourceCRLRevocationChecker(final Resource... crls) { this(new ResourceCRLFetcher(), CollectionUtils.wrapList(crls), DEFAULT_REFRESH_INTERVAL); }
/** * Get additional attributes from the certificate. * @param certificate X509 Certificate of user * @return map of attributes */ protected Map<String, List<Object>> extractPersonAttributes(final X509Certificate certificate) { val attributes = new LinkedHashMap<String, List<Object>>(); if (certificate != null) { if (StringUtils.isNotBlank(certificate.getSigAlgOID())) { attributes.put("sigAlgOid", CollectionUtils.wrapList(certificate.getSigAlgOID())); } val subjectDn = certificate.getSubjectDN(); if (subjectDn != null) { attributes.put("subjectDn", CollectionUtils.wrapList(subjectDn.getName())); } val subjectPrincipal = certificate.getSubjectX500Principal(); if (subjectPrincipal != null) { attributes.put("subjectX500Principal", CollectionUtils.wrapList(subjectPrincipal.getName())); } } return attributes; }
@RefreshScope @Bean public Collection<BaseOidcScopeAttributeReleasePolicy> userDefinedScopeBasedAttributeReleasePolicies() { val oidc = casProperties.getAuthn().getOidc(); return oidc.getUserDefinedScopes().entrySet() .stream() .map(k -> new OidcCustomScopeAttributeReleasePolicy(k.getKey(), CollectionUtils.wrapList(k.getValue().split(",")))) .collect(Collectors.toSet()); }
static Collection<StringSerializer<RegisteredService>> getRegisteredServiceSerializers() { return CollectionUtils.wrapList( new CasAddonsRegisteredServicesJsonSerializer(), new DefaultRegisteredServiceJsonSerializer()); }
/** * Instantiates a new Json service registry dao. * Sets the path to the directory where JSON service registry entries are * stored. Uses the {@link DefaultRegisteredServiceJsonSerializer} by default. * * @param configDirectory the config directory where service registry files can be found. * @param enableWatcher the enable watcher * @param eventPublisher the event publisher * @param registeredServiceReplicationStrategy the registered service replication strategy * @param resourceNamingStrategy the registered service naming strategy * @throws Exception the IO exception */ public JsonServiceRegistry(final Resource configDirectory, final boolean enableWatcher, final ApplicationEventPublisher eventPublisher, final RegisteredServiceReplicationStrategy registeredServiceReplicationStrategy, final RegisteredServiceResourceNamingStrategy resourceNamingStrategy) throws Exception { super(configDirectory, CollectionUtils.wrapList(new CasAddonsRegisteredServicesJsonSerializer(), new DefaultRegisteredServiceJsonSerializer()), enableWatcher, eventPublisher, registeredServiceReplicationStrategy, resourceNamingStrategy); }
/** * Gets groups for subject id. * * @param subjectId the principal * @return the groups for subject id */ public Collection<WsGetGroupsResult> getGroupsForSubjectId(final String subjectId) { try { val groupsClient = new GcGetGroups().addSubjectId(subjectId); val results = groupsClient.execute().getResults(); if (results == null || results.length == 0) { LOGGER.warn("Subject id [{}] could not be located.", subjectId); return new ArrayList<>(0); } LOGGER.debug("Found [{}] groups for [{}]", results.length, subjectId); return CollectionUtils.wrapList(results); } catch (final Exception e) { LOGGER.warn("Grouper WS did not respond successfully. Ensure your credentials are correct " + ", the url endpoint for Grouper WS is correctly configured and the subject [{}] exists in Grouper.", subjectId, e); } return new ArrayList<>(0); } }
private void cleanUpExpiredBackupMetadataFilesFor(final AbstractResource metadataResource, final SamlRegisteredService service) { val prefix = getBackupMetadataFilenamePrefix(metadataResource, service); val backups = FileUtils.listFiles(this.metadataBackupDirectory, new AndFileFilter(CollectionUtils.wrapList(new PrefixFileFilter(prefix, IOCase.INSENSITIVE), new SuffixFileFilter(".xml", IOCase.INSENSITIVE), CanWriteFileFilter.CAN_WRITE, CanReadFileFilter.CAN_READ)), TrueFileFilter.INSTANCE); backups.forEach(file -> { try { FileUtils.forceDelete(file); } catch (final Exception e) { LOGGER.warn("Unable to delete metadata backup file [{}]", file); LOGGER.debug(e.getMessage(), e); } }); }
/** * Gets transition execution criteria chain for transition. * * @param def the def * @return the transition execution criteria chain for transition */ public List<TransitionCriteria> getTransitionExecutionCriteriaChainForTransition(final Transition def) { if (def.getExecutionCriteria() instanceof TransitionCriteriaChain) { val chain = (TransitionCriteriaChain) def.getExecutionCriteria(); val field = ReflectionUtils.findField(chain.getClass(), "criteriaChain"); ReflectionUtils.makeAccessible(field); return (List<TransitionCriteria>) ReflectionUtils.getField(field, chain); } if (def.getExecutionCriteria() != null) { return CollectionUtils.wrapList(def.getExecutionCriteria()); } return new ArrayList<>(0); }
@Bean @RefreshScope public PrincipalResolver trustedPrincipalResolver() { val resolver = new ChainingPrincipalResolver(); val personDirectory = casProperties.getPersonDirectory(); val trusted = casProperties.getAuthn().getTrusted(); val principalAttribute = StringUtils.defaultIfBlank(trusted.getPrincipalAttribute(), personDirectory.getPrincipalAttribute()); val bearingPrincipalResolver = new PrincipalBearingPrincipalResolver(attributeRepository.getIfAvailable(), trustedPrincipalFactory(), trusted.isReturnNull() || personDirectory.isReturnNull(), principalAttribute, trusted.isUseExistingPrincipalId() || personDirectory.isUseExistingPrincipalId()); resolver.setChain(CollectionUtils.wrapList(new EchoingPrincipalResolver(), bearingPrincipalResolver)); return resolver; }
private void configurePasswordResetFlow(final Flow flow, final String id) { createFlowVariable(flow, FLOW_VAR_ID_PASSWORD, PasswordChangeBean.class); val binder = createStateBinderConfiguration(CollectionUtils.wrapList(FLOW_VAR_ID_PASSWORD, "confirmedPassword")); val viewState = createViewState(flow, id, id, binder); createStateModelBinding(viewState, FLOW_VAR_ID_PASSWORD, PasswordChangeBean.class); viewState.getEntryActionList().add(this.initPasswordChangeAction); val transition = createTransitionForState(viewState, CasWebflowConstants.TRANSITION_ID_SUBMIT, PASSWORD_CHANGE_ACTION); transition.getAttributes().put("bind", Boolean.TRUE); transition.getAttributes().put("validate", Boolean.TRUE); createStateDefaultTransition(viewState, id); val pswChangeAction = createActionState(flow, PASSWORD_CHANGE_ACTION, createEvaluateAction(PASSWORD_CHANGE_ACTION)); val transitionSet = pswChangeAction.getTransitionSet(); transitionSet.add(createTransition(PasswordChangeAction.PASSWORD_UPDATE_SUCCESS, CasWebflowConstants.STATE_ID_PASSWORD_UPDATE_SUCCESS)); transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_ERROR, id)); } }