Search in sources :

Example 21 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxTrust by GluuFederation.

the class AppInitializer method initUmaMetadataConfiguration.

@Produces
@ApplicationScoped
@Named("umaMetadataConfiguration")
public UmaConfiguration initUmaMetadataConfiguration() throws OxIntializationException {
    String umaConfigurationEndpoint = getUmaConfigurationEndpoint();
    if (StringHelper.isEmpty(umaConfigurationEndpoint)) {
        return null;
    }
    UmaConfigurationService metaDataConfigurationService = UmaClientFactory.instance().createMetaDataConfigurationService(umaConfigurationEndpoint);
    UmaConfiguration metadataConfiguration = metaDataConfigurationService.getMetadataConfiguration();
    if (metadataConfiguration == null) {
        throw new OxIntializationException("UMA meta data configuration is invalid!");
    }
    return metadataConfiguration;
}
Also used : UmaConfigurationService(org.xdi.oxauth.client.uma.UmaConfigurationService) UmaConfiguration(org.xdi.oxauth.model.uma.UmaConfiguration) OxIntializationException(org.xdi.exception.OxIntializationException) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 22 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxAuth by GluuFederation.

the class AppInitializer method getLdapEntryManager.

@Produces
@ApplicationScoped
@Named(LDAP_ENTRY_MANAGER_NAME)
public LdapEntryManager getLdapEntryManager() {
    LdapEntryManager ldapEntryManager = new LdapEntryManager(new OperationsFacade(this.connectionProvider, this.bindConnectionProvider));
    log.info("Created {}: {}", new Object[] { LDAP_ENTRY_MANAGER_NAME, ldapEntryManager.getLdapOperationService() });
    return ldapEntryManager;
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 23 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxAuth by GluuFederation.

the class ApplicationFactory method getSmtpConfiguration.

@Produces
@ApplicationScoped
public SmtpConfiguration getSmtpConfiguration() {
    GluuAppliance appliance = applianceService.getAppliance();
    SmtpConfiguration smtpConfiguration = appliance.getSmtpConfiguration();
    if (smtpConfiguration == null) {
        return null;
    }
    String password = smtpConfiguration.getPassword();
    if (StringHelper.isNotEmpty(password)) {
        try {
            smtpConfiguration.setPasswordDecrypted(encryptionService.decrypt(password));
        } catch (EncryptionException ex) {
            log.error("Failed to decript SMTP user password", ex);
        }
    }
    return smtpConfiguration;
}
Also used : GluuAppliance(org.xdi.oxauth.model.appliance.GluuAppliance) SmtpConfiguration(org.xdi.model.SmtpConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 24 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxAuth by GluuFederation.

the class AppInitializer method createLdapAuthEntryManager.

@Produces
@ApplicationScoped
@Named(LDAP_AUTH_ENTRY_MANAGER_NAME)
public List<LdapEntryManager> createLdapAuthEntryManager() {
    List<LdapEntryManager> ldapAuthEntryManagers = new ArrayList<LdapEntryManager>();
    if (this.ldapAuthConfigs.size() == 0) {
        return ldapAuthEntryManagers;
    }
    for (int i = 0; i < this.ldapAuthConfigs.size(); i++) {
        LdapEntryManager ldapAuthEntryManager = new LdapEntryManager(new OperationsFacade(this.authConnectionProviders.get(i), this.authBindConnectionProviders.get(i)));
        log.debug("Created {}#{}: {}", new Object[] { LDAP_AUTH_ENTRY_MANAGER_NAME, i, ldapAuthEntryManager });
        ldapAuthEntryManagers.add(ldapAuthEntryManager);
    }
    return ldapAuthEntryManagers;
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) ArrayList(java.util.ArrayList) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 25 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project deltaspike by apache.

the class ViewConfigResolverProducer method createViewConfigResolver.

@Produces
@ApplicationScoped
public ViewConfigResolver createViewConfigResolver() {
    if (!viewConfigExtension.isActivated()) {
        return createEmptyDefaultViewConfigResolver();
    }
    if (//esp. for easier unit-tests
    !viewConfigExtension.isTransformed()) {
        viewConfigExtension.transformMetaDataTree();
    }
    ViewConfigResolver viewConfigResolver = viewConfigExtension.getViewConfigResolver();
    if (viewConfigResolver == null) {
        LOG.warning("It wasn't possible to create a ViewConfigResolver");
        viewConfigResolver = createEmptyDefaultViewConfigResolver();
    }
    return viewConfigResolver;
}
Also used : ViewConfigResolver(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

ApplicationScoped (javax.enterprise.context.ApplicationScoped)25 Produces (javax.enterprise.inject.Produces)25 Named (javax.inject.Named)19 PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)12 Properties (java.util.Properties)8 OperationsFacade (org.gluu.site.ldap.OperationsFacade)4 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)4 OxIntializationException (org.xdi.exception.OxIntializationException)2 SmtpConfiguration (org.xdi.model.SmtpConfiguration)2 CacheConfiguration (org.xdi.service.cache.CacheConfiguration)2 InMemoryConfiguration (org.xdi.service.cache.InMemoryConfiguration)2 EncryptionException (org.xdi.util.security.StringEncrypter.EncryptionException)2 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 ViewConfigResolver (org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver)1 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)1 CentralLdap (org.gluu.oxtrust.service.cdi.event.CentralLdap)1