use of org.xdi.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdService method loadOpenIdConfiguration.
private void loadOpenIdConfiguration() {
String openIdProvider = appConfiguration.getOxAuthIssuer();
if (StringHelper.isEmpty(openIdProvider)) {
throw new ConfigurationException("OpenIdProvider Url is invalid");
}
openIdProvider = openIdProvider + "/.well-known/openid-configuration";
final OpenIdConfigurationClient openIdConfigurationClient = new OpenIdConfigurationClient(openIdProvider);
final OpenIdConfigurationResponse response = openIdConfigurationClient.execOpenIdConfiguration();
if ((response == null) || (response.getStatus() != 200)) {
throw new ConfigurationException("Failed to load oxAuth configuration");
}
log.info("Successfully loaded oxAuth configuration");
this.openIdConfiguration = response;
}
use of org.xdi.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdClient method loadOpenIdConfiguration.
private void loadOpenIdConfiguration() {
String openIdProvider = appConfiguration.getOpenIdProviderUrl();
if (StringHelper.isEmpty(openIdProvider)) {
throw new ConfigurationException("OpenIdProvider Url is invalid");
}
final OpenIdConfigurationClient openIdConfigurationClient = new OpenIdConfigurationClient(openIdProvider);
final OpenIdConfigurationResponse response = openIdConfigurationClient.execOpenIdConfiguration();
if ((response == null) || (response.getStatus() != 200)) {
throw new ConfigurationException("Failed to load oxAuth configuration");
}
logger.info("Successfully loaded oxAuth configuration");
this.openIdConfiguration = response;
}
use of org.xdi.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdClient method registerOpenIdClient.
private RegisterResponse registerOpenIdClient() {
logger.info("Registering OpenId client");
String clientName = this.appConfiguration.getApplicationName() + " client";
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, clientName, Arrays.asList(this.appConfiguration.getOpenIdRedirectUrl()));
registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS256);
registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_BASIC);
RegisterClient registerClient = new RegisterClient(openIdConfiguration.getRegistrationEndpoint());
registerClient.setRequest(registerRequest);
RegisterResponse response = registerClient.exec();
if ((response == null) || (response.getStatus() != 200)) {
throw new ConfigurationException("Failed to register new client");
}
return response;
}
use of org.xdi.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class Configuration method loadLdapConfiguration.
public FileConfiguration loadLdapConfiguration(String ldapConfigurationFileName, boolean mandatory) {
try {
if (StringHelper.isEmpty(ldapConfigurationFileName)) {
if (mandatory) {
throw new ConfigurationException("Failed to load Ldap configuration file!");
} else {
return null;
}
}
String ldapConfigurationFilePath = DIR + ldapConfigurationFileName;
FileConfiguration ldapConfiguration = new FileConfiguration(ldapConfigurationFilePath);
if (ldapConfiguration.isLoaded()) {
File ldapFile = new File(ldapConfigurationFilePath);
if (ldapFile.exists()) {
this.ldapFileLastModifiedTime = ldapFile.lastModified();
}
return ldapConfiguration;
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
throw new ConfigurationException("Failed to load Ldap configuration from " + ldapConfigurationFileName, ex);
}
if (mandatory) {
throw new ConfigurationException("Failed to load Ldap configuration from " + ldapConfigurationFileName);
}
return null;
}
Aggregations