1
0
mirror of synced 2026-08-04 09:17:02 +00:00

SEC-559: Throw an initialization exception if configured truststore file doesn't exist.

This commit is contained in:
Luke Taylor
2007-09-17 21:29:40 +00:00
parent 96eb11aadc
commit e872823490
2 changed files with 32 additions and 23 deletions
@@ -16,15 +16,16 @@
package org.acegisecurity.providers.cas.ticketvalidator;
import org.acegisecurity.providers.cas.TicketValidator;
import org.acegisecurity.ui.cas.ServiceProperties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.io.File;
/**
@@ -50,9 +51,11 @@ public abstract class AbstractTicketValidator implements TicketValidator, Initia
Assert.hasLength(casValidate, "A casValidate URL must be set");
Assert.notNull(serviceProperties, "serviceProperties must be specified");
if ((trustStore != null) && (!"".equals(trustStore))) {
if (logger.isDebugEnabled()) {
logger.debug("Setting system property 'javax.net.ssl.trustStore'" + " to value [" + trustStore + "]");
if (StringUtils.hasLength(trustStore)) {
logger.info("Setting system property 'javax.net.ssl.trustStore' to value [" + trustStore + "]");
if (! (new File(trustStore)).exists()) {
throw new IllegalArgumentException("Parameter 'trustStore' file does not exist at " + trustStore);
}
System.setProperty("javax.net.ssl.trustStore", trustStore);