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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations