Removed .springBeans from tracking; removed initializingbean in favor of @PostConstruct

pull/419/merge
Amanda Anganes 2013-07-18 09:34:34 -04:00
parent 7b969f9776
commit 88db457fc4
4 changed files with 24 additions and 49 deletions

View File

@ -22,7 +22,8 @@ package org.mitre.jose.keystore;
import java.io.InputStreamReader;
import java.util.List;
import org.springframework.beans.factory.InitializingBean;
import javax.annotation.PostConstruct;
import org.springframework.core.io.Resource;
import com.google.common.base.Charsets;
@ -34,7 +35,7 @@ import com.nimbusds.jose.jwk.JWKSet;
* @author jricher
*
*/
public class JWKSetKeyStore implements InitializingBean {
public class JWKSetKeyStore {
private JWKSet jwkSet;
@ -48,10 +49,7 @@ public class JWKSetKeyStore implements InitializingBean {
this.jwkSet = jwkSet;
}
/* (non-Javadoc)
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
@Override
@PostConstruct
public void afterPropertiesSet() throws Exception {
if (jwkSet == null) {

View File

@ -24,11 +24,12 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct;
import org.mitre.jose.keystore.JWKSetKeyStore;
import org.mitre.jwt.signer.service.JwtSigningAndValidationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import com.google.common.base.Strings;
import com.nimbusds.jose.JOSEException;
@ -45,7 +46,7 @@ import com.nimbusds.jose.jwk.OctetSequenceKey;
import com.nimbusds.jose.jwk.RSAKey;
import com.nimbusds.jwt.SignedJWT;
public class DefaultJwtSigningAndValidationService implements JwtSigningAndValidationService, InitializingBean {
public class DefaultJwtSigningAndValidationService implements JwtSigningAndValidationService {
// map of identifier to signer
private Map<String, JWSSigner> signers = new HashMap<String, JWSSigner>();
@ -103,6 +104,18 @@ public class DefaultJwtSigningAndValidationService implements JwtSigningAndValid
buildSignersAndVerifiers();
}
@PostConstruct
public void afterPropertiesSet() throws NoSuchAlgorithmException, InvalidKeySpecException{
if (keys == null) {
throw new IllegalArgumentException("Signing and validation service must have at least one key configured.");
}
buildSignersAndVerifiers();
logger.info("DefaultJwtSigningAndValidationService is ready: " + this.toString());
}
/**
* @return the defaultSignerKeyId
*/
@ -137,24 +150,6 @@ public class DefaultJwtSigningAndValidationService implements JwtSigningAndValid
}
}
/*
* (non-Javadoc)
*
* @see
* org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() throws NoSuchAlgorithmException, InvalidKeySpecException{
if (keys == null) {
throw new IllegalArgumentException("Signing and validation service must have at least one key configured.");
}
buildSignersAndVerifiers();
logger.info("DefaultJwtSigningAndValidationService is ready: " + this.toString());
}
/**
* Build all of the signers and verifiers for this based on the key map.
* @throws InvalidKeySpecException If the keys in the JWKs are not valid

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[3.2.0.201303060654-RELEASE]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
<config>src/main/webapp/WEB-INF/user-context.xml</config>
<config>src/main/webapp/WEB-INF/server-config.xml</config>
<config>src/main/webapp/WEB-INF/local-config.xml</config>
<config>src/main/webapp/WEB-INF/data-context.xml</config>
<config>src/main/webapp/WEB-INF/crypto-config.xml</config>
<config>src/main/webapp/WEB-INF/application-context.xml</config>
<config>src/main/webapp/WEB-INF/task-config.xml</config>
</configs>
<configSets>
</configSets>
</beansProjectDescription>

View File

@ -19,6 +19,8 @@ package org.mitre.openid.connect.service.impl;
import java.util.Collection;
import java.util.Date;
import javax.annotation.PostConstruct;
import org.joda.time.DateTime;
import org.joda.time.Period;
import org.mitre.openid.connect.model.Nonce;
@ -26,12 +28,11 @@ import org.mitre.openid.connect.repository.NonceRepository;
import org.mitre.openid.connect.service.NonceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("defaultNonceService")
public class DefaultNonceService implements NonceService, InitializingBean {
public class DefaultNonceService implements NonceService {
private static Logger logger = LoggerFactory.getLogger(NonceService.class);
@ -44,11 +45,12 @@ public class DefaultNonceService implements NonceService, InitializingBean {
/**
* Make sure that the nonce storage duration was set
*/
@Override
@PostConstruct
public void afterPropertiesSet() throws Exception {
if (nonceStorageDuration == null) {
logger.error("Nonce storage duration must be set!");
}
logger.info("Nonce Service ready to go");
}
@Override