Search in sources :

Example 21 with Produces

use of javax.enterprise.inject.Produces in project oxTrust by GluuFederation.

the class AppInitializer method initOpenIdConfiguration.

@Produces
@ApplicationScoped
@Named("openIdConfiguration")
public OpenIdConfigurationResponse initOpenIdConfiguration() throws OxIntializationException {
    String oxAuthIssuer = this.configurationFactory.getAppConfiguration().getOxAuthIssuer();
    if (StringHelper.isEmpty(oxAuthIssuer)) {
        log.info("oxAuth issuer isn't specified");
        return null;
    }
    log.debug("Attempting to determine configuration endpoint URL");
    OpenIdConnectDiscoveryClient openIdConnectDiscoveryClient;
    try {
        openIdConnectDiscoveryClient = new OpenIdConnectDiscoveryClient(oxAuthIssuer);
    } catch (URISyntaxException ex) {
        throw new OxIntializationException("OpenId discovery response is invalid!", ex);
    }
    OpenIdConnectDiscoveryResponse openIdConnectDiscoveryResponse = openIdConnectDiscoveryClient.exec();
    if ((openIdConnectDiscoveryResponse.getStatus() != 200) || (openIdConnectDiscoveryResponse.getSubject() == null) || (openIdConnectDiscoveryResponse.getLinks().size() == 0)) {
        throw new OxIntializationException("OpenId discovery response is invalid!");
    }
    log.debug("Attempting to load OpenID configuration");
    String configurationEndpoint = openIdConnectDiscoveryResponse.getLinks().get(0).getHref() + "/.well-known/openid-configuration";
    OpenIdConfigurationClient client = new OpenIdConfigurationClient(configurationEndpoint);
    OpenIdConfigurationResponse openIdConfiguration = client.execOpenIdConfiguration();
    if (openIdConfiguration.getStatus() != 200) {
        throw new OxIntializationException("OpenId configuration response is invalid!");
    }
    return openIdConfiguration;
}
Also used : OpenIdConnectDiscoveryClient(org.xdi.oxauth.client.OpenIdConnectDiscoveryClient) OpenIdConfigurationClient(org.xdi.oxauth.client.OpenIdConfigurationClient) OpenIdConnectDiscoveryResponse(org.xdi.oxauth.client.OpenIdConnectDiscoveryResponse) OpenIdConfigurationResponse(org.xdi.oxauth.client.OpenIdConfigurationResponse) URISyntaxException(java.net.URISyntaxException) OxIntializationException(org.xdi.exception.OxIntializationException) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 22 with Produces

use of javax.enterprise.inject.Produces in project oxTrust 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));
    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 Produces

use of javax.enterprise.inject.Produces in project oxTrust 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.gluu.oxtrust.model.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 Produces

use of javax.enterprise.inject.Produces in project indy by Commonjava.

the class ProxyConfigProvider method getStorageProviderConfiguration.

@Produces
@TestData
@Default
public synchronized DefaultStorageProviderConfiguration getStorageProviderConfiguration() throws IOException {
    if (storageConfig == null) {
        final String path = System.getProperty(REPO_ROOT_DIR);
        File dir;
        if (path == null) {
            dir = File.createTempFile("repo.root", ".dir");
            dir.delete();
            dir.mkdirs();
        } else {
            dir = new File(path);
        }
        storageConfig = new DefaultStorageProviderConfiguration(dir);
    }
    return storageConfig;
}
Also used : DefaultStorageProviderConfiguration(org.commonjava.indy.filer.def.conf.DefaultStorageProviderConfiguration) File(java.io.File) TestData(org.commonjava.indy.inject.TestData) Produces(javax.enterprise.inject.Produces) Default(javax.enterprise.inject.Default)

Example 25 with Produces

use of javax.enterprise.inject.Produces in project camel by apache.

the class Jms method sjms.

@Produces
@Named("sjms")
@ApplicationScoped
SjmsComponent sjms() {
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useShutdownHook=false&broker.useJmx=false"));
    component.setConnectionCount(maxConnections);
    return component;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

Produces (javax.enterprise.inject.Produces)51 Named (javax.inject.Named)31 ApplicationScoped (javax.enterprise.context.ApplicationScoped)25 PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)12 Properties (java.util.Properties)10 ArrayList (java.util.ArrayList)6 Dependent (javax.enterprise.context.Dependent)4 OperationsFacade (org.gluu.site.ldap.OperationsFacade)4 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)4 InjectableResource (org.apache.deltaspike.core.api.resourceloader.InjectableResource)3 InjectableResourceProvider (org.apache.deltaspike.core.api.resourceloader.InjectableResourceProvider)3 ParameterizedType (java.lang.reflect.ParameterizedType)2 Type (java.lang.reflect.Type)2 FieldMetaData (org.fusesource.camel.component.sap.model.rfc.FieldMetaData)2 FunctionTemplate (org.fusesource.camel.component.sap.model.rfc.FunctionTemplate)2 ListFieldMetaData (org.fusesource.camel.component.sap.model.rfc.ListFieldMetaData)2 RecordMetaData (org.fusesource.camel.component.sap.model.rfc.RecordMetaData)2 OxIntializationException (org.xdi.exception.OxIntializationException)2 SmtpConfiguration (org.xdi.model.SmtpConfiguration)2 FunctionMapperImpl (com.sun.el.lang.FunctionMapperImpl)1