Search in sources :

Example 26 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project uPortal by Jasig.

the class PersonDirectoryConfiguration method getRequestAttributesDao.

/**
 * The person attributes DAO that returns the attributes from the request. Uses a
 * currentUserProvider since the username may not always be provided by the request object.
 */
@Bean(name = "requestAttributesDao")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getRequestAttributesDao() {
    final AdditionalDescriptorsPersonAttributeDao rslt = new AdditionalDescriptorsPersonAttributeDao();
    rslt.setDescriptors(getRequestAdditionalDescriptors());
    rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
    rslt.setCurrentUserProvider(getCurrentUserProvider());
    return rslt;
}
Also used : AdditionalDescriptorsPersonAttributeDao(org.apereo.services.persondir.support.AdditionalDescriptorsPersonAttributeDao) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Bean(org.springframework.context.annotation.Bean)

Example 27 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project uPortal by Jasig.

the class PersonDirectoryConfiguration method getUPortalJdbcUserSource.

/**
 * Looks in the base UP_USER table, doesn't find attributes but will ensure a result if it the
 * user exists in the portal database and is searched for by username, results are cached by the
 * outer caching DAO.
 */
@Bean(name = "uPortalJdbcUserSource")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getUPortalJdbcUserSource() {
    final String sql = "SELECT USER_NAME FROM UP_USER WHERE {0}";
    final SingleRowJdbcPersonAttributeDao rslt = new SingleRowJdbcPersonAttributeDao(personDb, sql);
    rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
    rslt.setQueryAttributeMapping(Collections.singletonMap(USERNAME_ATTRIBUTE, USERNAME_COLUMN_NAME));
    final Map<String, Set<String>> resultAttributeMapping = new HashMap<>();
    resultAttributeMapping.put(USERNAME_COLUMN_NAME, Stream.of(USERNAME_ATTRIBUTE, UID_ATTRIBUTE, USER_LOGIN_ID_ATTRIBUTE).collect(Collectors.toSet()));
    rslt.setResultAttributeMapping(resultAttributeMapping);
    return rslt;
}
Also used : SingleRowJdbcPersonAttributeDao(org.apereo.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Bean(org.springframework.context.annotation.Bean)

Example 28 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project zipkin by openzipkin.

the class ZipkinElasticsearchStorageConfiguration method dynamicCredentialsScheduledExecutorService.

@Bean(destroyMethod = "shutdown")
@Qualifier(QUALIFIER)
@Conditional(DynamicRefreshRequired.class)
ScheduledExecutorService dynamicCredentialsScheduledExecutorService(@Value("${" + CREDENTIALS_FILE + "}") String credentialsFile, @Value("${" + CREDENTIALS_REFRESH_INTERVAL + "}") Integer credentialsRefreshInterval, @Qualifier(QUALIFIER) BasicCredentials basicCredentials) throws IOException {
    ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("zipkin-load-es-credentials"));
    DynamicCredentialsFileLoader credentialsFileLoader = new DynamicCredentialsFileLoader(basicCredentials, credentialsFile);
    credentialsFileLoader.updateCredentialsFromProperties();
    ScheduledFuture<?> future = ses.scheduleAtFixedRate(credentialsFileLoader, 0, credentialsRefreshInterval, TimeUnit.SECONDS);
    if (future.isDone())
        throw new RuntimeException("credential refresh thread didn't start");
    return ses;
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) NamedThreadFactory(io.micrometer.core.instrument.util.NamedThreadFactory) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Conditional(org.springframework.context.annotation.Conditional) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 29 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project open-kilda by telstra.

the class SecurityConfig method ssoCircleExtendedMetadataProvider.

@Bean
@Qualifier("idp-ssocircle")
public ExtendedMetadataDelegate ssoCircleExtendedMetadataProvider() throws MetadataProviderException {
    DbMetadataProvider provider = new DbMetadataProvider();
    ExtendedMetadataDelegate extendedMetadataDelegate = new ExtendedMetadataDelegate(provider, extendedMetadata());
    extendedMetadataDelegate.setMetadataTrustCheck(false);
    extendedMetadataDelegate.setMetadataRequireSignature(false);
    return extendedMetadataDelegate;
}
Also used : DbMetadataProvider(org.openkilda.saml.provider.DbMetadataProvider) ExtendedMetadataDelegate(org.springframework.security.saml.metadata.ExtendedMetadataDelegate) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Bean(org.springframework.context.annotation.Bean)

Example 30 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project open-kilda by telstra.

the class SecurityConfig method metadata.

@Bean
@Qualifier("metadata")
public CachingMetadataManager metadata(ExtendedMetadataDelegate extendedMetadataDelegate) throws MetadataProviderException, IOException {
    List<MetadataProvider> metadataProviderList = new ArrayList<>();
    List<SamlConfigEntity> samlConfigEntityList = samlRepository.findAll();
    if (samlConfigEntityList != null) {
        for (final SamlConfigEntity samlConfigEntity : samlConfigEntityList) {
            if (samlConfigEntity.getUrl() != null) {
                UrlMetadataProvider urlMetadataProvider = new UrlMetadataProvider(new Timer(true), new HttpClient(), samlConfigEntity.getUuid());
                urlMetadataProvider.setParserPool(ParserPoolHolder.getPool());
                ExtendedMetadataDelegate metadataDelegate = new ExtendedMetadataDelegate(urlMetadataProvider, extendedMetadata());
                metadataDelegate.setMetadataTrustCheck(false);
                metadataDelegate.setMetadataRequireSignature(false);
                metadataProviderList.add(metadataDelegate);
            } else {
                DbMetadataProvider metadataProvider = new DbMetadataProvider(new Timer(true), samlConfigEntity.getUuid());
                metadataProvider.setParserPool(ParserPoolHolder.getPool());
                ExtendedMetadataDelegate metadataDelegate = new ExtendedMetadataDelegate(metadataProvider, extendedMetadata());
                metadataDelegate.setMetadataTrustCheck(false);
                metadataDelegate.setMetadataRequireSignature(false);
                metadataProviderList.add(metadataDelegate);
            }
        }
    }
    return new CachingMetadataManager(metadataProviderList);
}
Also used : DbMetadataProvider(org.openkilda.saml.provider.DbMetadataProvider) Timer(java.util.Timer) UrlMetadataProvider(org.openkilda.saml.provider.UrlMetadataProvider) DbMetadataProvider(org.openkilda.saml.provider.DbMetadataProvider) MetadataProvider(org.opensaml.saml2.metadata.provider.MetadataProvider) UrlMetadataProvider(org.openkilda.saml.provider.UrlMetadataProvider) HttpClient(org.apache.commons.httpclient.HttpClient) ArrayList(java.util.ArrayList) ExtendedMetadataDelegate(org.springframework.security.saml.metadata.ExtendedMetadataDelegate) SamlConfigEntity(org.openkilda.saml.dao.entity.SamlConfigEntity) CachingMetadataManager(org.springframework.security.saml.metadata.CachingMetadataManager) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Bean(org.springframework.context.annotation.Bean)

Aggregations

Qualifier (org.springframework.beans.factory.annotation.Qualifier)66 Bean (org.springframework.context.annotation.Bean)59 RmiProxyFactoryBean (org.springframework.remoting.rmi.RmiProxyFactoryBean)18 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)12 Configuration (org.springframework.context.annotation.Configuration)7 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)6 lombok.val (lombok.val)5 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)5 ConfigurationProperties (org.springframework.boot.context.properties.ConfigurationProperties)5 RequestResponseClientConfigProperties (org.eclipse.hono.client.RequestResponseClientConfigProperties)4 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)4 ScopedProxyMode (org.springframework.context.annotation.ScopedProxyMode)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 ClientFactoryBuilder (com.linecorp.armeria.client.ClientFactoryBuilder)2 IdMCacheConfiguration (eu.bcvsolutions.idm.core.api.config.cache.IdMCacheConfiguration)2 Supplier (java.util.function.Supplier)2