use of org.xdi.exception.OxIntializationException 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 org.xdi.exception.OxIntializationException in project oxTrust by GluuFederation.
the class AppInitializer method initUmaMetadataConfiguration.
@Produces
@ApplicationScoped
@Named("umaMetadataConfiguration")
public UmaMetadata initUmaMetadataConfiguration() throws OxIntializationException {
String umaConfigurationEndpoint = getUmaConfigurationEndpoint();
if (StringHelper.isEmpty(umaConfigurationEndpoint)) {
return null;
}
UmaMetadataService metaDataConfigurationService = UmaClientFactory.instance().createMetadataService(umaConfigurationEndpoint);
UmaMetadata metadataConfiguration = metaDataConfigurationService.getMetadata();
if (metadataConfiguration == null) {
throw new OxIntializationException("UMA meta data configuration is invalid!");
}
return metadataConfiguration;
}
Aggregations