All logging is now org.slf4j. We had a mix of org.slf4j and apache commons-logging. Added error logging to all view which throw errors.
parent
a061e64abf
commit
8d4e046408
|
@ -24,8 +24,8 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -82,8 +82,8 @@ public class AccountChooserController {
|
|||
@Autowired
|
||||
AccountChooserConfig accountChooserConfig;
|
||||
|
||||
private static Log logger = LogFactory
|
||||
.getLog(AccountChooserController.class);
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(AccountChooserController.class);
|
||||
|
||||
/**
|
||||
* Handles request to choose an Account
|
||||
|
|
|
@ -26,9 +26,9 @@ import java.util.Map;
|
|||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.mitre.jdbc.datasource.util.SqlFileParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
|
@ -61,7 +61,7 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|||
*/
|
||||
public class H2DataSourceFactory implements FactoryBean {
|
||||
|
||||
private static Log logger = LogFactory.getLog(H2DataSourceFactory.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(H2DataSourceFactory.class);
|
||||
|
||||
protected String databaseName;
|
||||
protected Boolean persist;
|
||||
|
|
|
@ -25,8 +25,8 @@ import java.util.Stack;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@ import org.springframework.core.io.Resource;
|
|||
*/
|
||||
public class SqlFileParser {
|
||||
|
||||
private static Log logger = LogFactory.getLog(SqlFileParser.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(SqlFileParser.class);
|
||||
|
||||
private static final Pattern WORD_PATTERN = Pattern
|
||||
.compile("^([a-zA-Z]*)[ ;]");
|
||||
|
|
|
@ -19,24 +19,18 @@ import java.io.UnsupportedEncodingException;
|
|||
import java.nio.charset.Charset;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.mitre.jwt.signer.AbstractJwtSigner;
|
||||
import org.mitre.jwt.signer.JwsAlgorithm;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
/**
|
||||
* JWT Signer using either the HMAC SHA-256, SHA-384, SHA-512 hash algorithm
|
||||
*
|
||||
|
@ -49,7 +43,7 @@ public class HmacSigner extends AbstractJwtSigner implements InitializingBean {
|
|||
|
||||
public static final JwsAlgorithm DEFAULT_ALGORITHM = JwsAlgorithm.HS256;
|
||||
|
||||
private static Log logger = LogFactory.getLog(HmacSigner.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(HmacSigner.class);
|
||||
|
||||
private Mac mac;
|
||||
|
||||
|
@ -148,9 +142,9 @@ public class HmacSigner extends AbstractJwtSigner implements InitializingBean {
|
|||
|
||||
mac.update(signatureBase.getBytes("UTF-8"));
|
||||
} catch (GeneralSecurityException e) {
|
||||
logger.error(e);
|
||||
logger.error("GeneralSecurityException in HmacSigner.java: " + e.getStackTrace());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error(e);
|
||||
logger.error("UnsupportedEncodingException in HmacSigner.java: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
byte[] sigBytes = mac.doFinal();
|
||||
|
|
|
@ -26,11 +26,11 @@ import java.security.interfaces.RSAPrivateKey;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.mitre.jwt.signer.AbstractJwtSigner;
|
||||
import org.mitre.jwt.signer.JwsAlgorithm;
|
||||
import org.mitre.jwt.signer.service.impl.KeyStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
@ -45,7 +45,7 @@ import com.google.common.collect.Lists;
|
|||
*/
|
||||
public class RsaSigner extends AbstractJwtSigner implements InitializingBean {
|
||||
|
||||
private static Log logger = LogFactory.getLog(RsaSigner.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(RsaSigner.class);
|
||||
|
||||
public static final String KEYPAIR_ALGORITHM = "RSA";
|
||||
public static final String DEFAULT_PASSWORD = "changeit";
|
||||
|
@ -184,9 +184,9 @@ public class RsaSigner extends AbstractJwtSigner implements InitializingBean {
|
|||
|
||||
sig = (new String(Base64.encodeBase64URLSafe(sigBytes))).replace("=", "");
|
||||
} catch (GeneralSecurityException e) {
|
||||
logger.error(e);
|
||||
logger.error("GeneralSecurityException in RsaSigner.java: " + e.getStackTrace());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error(e);
|
||||
logger.error("UnsupportedEncodingException in RsaSigner.java: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
return sig;
|
||||
|
@ -281,9 +281,9 @@ public class RsaSigner extends AbstractJwtSigner implements InitializingBean {
|
|||
signer.update(signingInput.getBytes("UTF-8"));
|
||||
value = signer.verify(Base64.decodeBase64(s64));
|
||||
} catch (GeneralSecurityException e) {
|
||||
logger.error(e);
|
||||
logger.error("GeneralSecurityException in RsaSigner.java: " + e.getStackTrace());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error(e);
|
||||
logger.error("UnsupportedEncodingException in RsaSigner.java: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -19,12 +19,12 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.mitre.jwt.model.Jwt;
|
||||
import org.mitre.jwt.signer.JwtSigner;
|
||||
import org.mitre.jwt.signer.service.JwtSigningAndValidationService;
|
||||
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
@ -37,8 +37,7 @@ public class JwtSigningAndValidationServiceDefault extends AbstractJwtSigningAnd
|
|||
// map of identifier to signer
|
||||
private Map<String, ? extends JwtSigner> signers = new HashMap<String, JwtSigner>();
|
||||
|
||||
private static Log logger = LogFactory
|
||||
.getLog(JwtSigningAndValidationServiceDefault.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(JwtSigningAndValidationServiceDefault.class);
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
|
|
|
@ -23,8 +23,8 @@ import java.security.PrivateKey;
|
|||
import java.security.Provider;
|
||||
import java.security.PublicKey;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
|
@ -36,7 +36,7 @@ import org.springframework.core.io.Resource;
|
|||
*/
|
||||
public class KeyStore implements InitializingBean {
|
||||
|
||||
private static Log logger = LogFactory.getLog(KeyStore.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(KeyStore.class);
|
||||
|
||||
public static final String TYPE = java.security.KeyStore.getDefaultType();
|
||||
public static final String PASSWORD = "changeit";
|
||||
|
|
|
@ -13,11 +13,11 @@ import java.security.spec.InvalidKeySpecException;
|
|||
import java.security.spec.RSAPublicKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.mitre.openid.connect.config.OIDCServerConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.security.authentication.AuthenticationServiceException;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
@ -33,7 +33,7 @@ public class KeyFetcher {
|
|||
private HttpComponentsClientHttpRequestFactory httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||
private RestTemplate restTemplate = new RestTemplate(httpFactory);
|
||||
|
||||
private static Log logger = LogFactory.getLog(KeyFetcher.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(KeyFetcher.class);
|
||||
|
||||
public JsonArray retrieveJwk(OIDCServerConfiguration serverConfig){
|
||||
|
||||
|
@ -64,11 +64,10 @@ public class KeyFetcher {
|
|||
CertificateFactory factory = CertificateFactory.getInstance("X.509");
|
||||
X509Certificate cert = (X509Certificate) factory.generateCertificate(x509Stream);
|
||||
key = cert.getPublicKey();
|
||||
} catch (HttpClientErrorException httpClientErrorException) {
|
||||
logger.error(httpClientErrorException);
|
||||
} catch (HttpClientErrorException e) {
|
||||
logger.error("HttpClientErrorException in KeyFetcher.java: " + e.getStackTrace());
|
||||
} catch (CertificateException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("CertificateException in KeyFetcher.java: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
return key;
|
||||
|
@ -97,14 +96,12 @@ public class KeyFetcher {
|
|||
}
|
||||
}
|
||||
|
||||
} catch (HttpClientErrorException httpClientErrorException) {
|
||||
logger.error(httpClientErrorException);
|
||||
} catch (HttpClientErrorException e) {
|
||||
logger.error("HttpClientErrorException in KeyFetcher.java: " + e.getStackTrace());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("NoSuchAlgorithmException in KeyFetcher.java: " + e.getStackTrace());
|
||||
} catch (InvalidKeySpecException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("InvalidKeySpecException in KeyFetcher.java: " + e.getStackTrace());
|
||||
}
|
||||
return pub;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
||||
|
@ -39,6 +41,8 @@ import com.google.gson.JsonSerializationContext;
|
|||
import com.google.gson.JsonSerializer;
|
||||
|
||||
public class TokenIntrospection extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(TokenIntrospection.class);
|
||||
|
||||
@Override
|
||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
@ -114,8 +118,7 @@ public class TokenIntrospection extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException occurred in TokenIntrospection.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
||||
|
@ -33,6 +35,8 @@ import com.google.gson.JsonObject;
|
|||
@Component("exceptionAsJSONView")
|
||||
public class ExceptionAsJSONView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ExceptionAsJSONView.class);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -60,8 +64,7 @@ public class ExceptionAsJSONView extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in ExceptionAsJSONView.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -23,6 +25,8 @@ import com.google.gson.GsonBuilder;
|
|||
|
||||
@Component("jsonClientView")
|
||||
public class JSONClientView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JSONClientView.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
|
@ -63,8 +67,7 @@ public class JSONClientView extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in JSONClientView.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.mitre.openid.connect.model.UserInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -37,6 +39,8 @@ import com.google.gson.JsonObject;
|
|||
@Component("jsonUserInfoView")
|
||||
public class JSONUserInfoView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JSONUserInfoView.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
|
@ -75,8 +79,7 @@ public class JSONUserInfoView extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in JSONUserInfoView.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.mitre.jwt.signer.JwtSigner;
|
||||
import org.mitre.jwt.signer.impl.RsaSigner;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -48,6 +50,8 @@ import com.google.gson.JsonObject;
|
|||
@Component("jwkKeyList")
|
||||
public class JwkKeyListView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JwkKeyListView.class);
|
||||
|
||||
@Override
|
||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
|
@ -118,8 +122,7 @@ public class JwkKeyListView extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in JwkKeyListView.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.mitre.openid.connect.model.UserInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -36,7 +38,9 @@ import com.google.gson.JsonArray;
|
|||
import com.google.gson.JsonObject;
|
||||
|
||||
@Component("pocoUserInfoView")
|
||||
public class POCOUserInfoView extends AbstractView{
|
||||
public class POCOUserInfoView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(POCOUserInfoView.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
|
@ -76,8 +80,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in POCOUserInfoView.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
|
||||
|
@ -101,7 +104,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
if (scope.contains("profile")) {
|
||||
entry.addProperty("displayName", ui.getNickname());
|
||||
|
||||
if(ui.getFamilyName() != null
|
||||
if (ui.getFamilyName() != null
|
||||
|| ui.getGivenName() != null
|
||||
|| ui.getMiddleName() != null
|
||||
|| ui.getName() != null) {
|
||||
|
@ -115,7 +118,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
|
||||
entry.addProperty("gender", ui.getGender());
|
||||
entry.addProperty("preferredUsername", ui.getPreferredUsername());
|
||||
if(ui.getPicture() != null){
|
||||
if (ui.getPicture() != null){
|
||||
JsonObject photo = new JsonObject();
|
||||
photo.addProperty("value", ui.getPicture());
|
||||
|
||||
|
@ -124,7 +127,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
entry.add("photos", photoArray);
|
||||
}
|
||||
|
||||
if(ui.getWebsite() != null) {
|
||||
if (ui.getWebsite() != null) {
|
||||
JsonObject website = new JsonObject();
|
||||
website.addProperty("value", ui.getWebsite());
|
||||
|
||||
|
@ -138,7 +141,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
}
|
||||
|
||||
if (scope.contains("email")) {
|
||||
if(ui.getEmail() != null) {
|
||||
if (ui.getEmail() != null) {
|
||||
JsonObject email = new JsonObject();
|
||||
email.addProperty("value", ui.getEmail());
|
||||
|
||||
|
@ -149,7 +152,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
}
|
||||
|
||||
if (scope.contains("phone")) {
|
||||
if(ui.getPhoneNumber() != null){
|
||||
if (ui.getPhoneNumber() != null){
|
||||
JsonObject phone = new JsonObject();
|
||||
phone.addProperty("value", ui.getPhoneNumber());
|
||||
|
||||
|
@ -161,7 +164,7 @@ public class POCOUserInfoView extends AbstractView{
|
|||
}
|
||||
|
||||
if (scope.contains("address")) {
|
||||
if(ui.getAddress() != null) {
|
||||
if (ui.getAddress() != null) {
|
||||
JsonObject addr = new JsonObject();
|
||||
addr.addProperty("formatted", ui.getAddress().getFormatted());
|
||||
addr.addProperty("streetAddress", ui.getAddress().getStreetAddress());
|
||||
|
|
|
@ -35,6 +35,8 @@ import org.bouncycastle.x509.extension.SubjectKeyIdentifierStructure;
|
|||
import org.mitre.jwt.signer.JwtSigner;
|
||||
import org.mitre.jwt.signer.impl.RsaSigner;
|
||||
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -50,6 +52,8 @@ import com.google.gson.JsonObject;
|
|||
@Component("x509certs")
|
||||
public class X509CertificateView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(X509CertificateView.class);
|
||||
|
||||
@Autowired
|
||||
private ConfigurationPropertiesBean config;
|
||||
private long daysNotValidBefore = 30;
|
||||
|
@ -90,20 +94,15 @@ public class X509CertificateView extends AbstractView {
|
|||
X509Certificate cert = v3CertGen.generate(rsaSigner.getPrivateKey());
|
||||
pemWriter.writeObject(cert);
|
||||
} catch (CertificateEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("CertificateEncodingException in X509CertificateView.java: " + e.getStackTrace());
|
||||
} catch (InvalidKeyException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("InvalidKeyException in X509CertificateView.java: " + e.getStackTrace());
|
||||
} catch (IllegalStateException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IllegalStateException in X509CertificateView.java" + e.getStackTrace());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("NoSuchAlgorithmException in X509CertificateView.java" + e.getStackTrace());
|
||||
} catch (SignatureException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("SignatureException in X509CertificateView.java" + e.getStackTrace());
|
||||
} finally {
|
||||
pemWriter.flush();
|
||||
writer.flush();
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -34,6 +36,8 @@ import com.google.gson.GsonBuilder;
|
|||
@Component("jsonOpenIdConfigurationView")
|
||||
public class JsonOpenIdConfigurationView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonOpenIdConfigurationView.class);
|
||||
|
||||
@Override
|
||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||
Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() {
|
||||
|
@ -72,8 +76,7 @@ public class JsonOpenIdConfigurationView extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in JsonOpenIdConfigurationView.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -40,6 +42,8 @@ import com.google.gson.GsonBuilder;
|
|||
*/
|
||||
@Component("jsonSwdResponseView")
|
||||
public class SwdResponse extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SwdResponse.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
|
@ -82,8 +86,7 @@ public class SwdResponse extends AbstractView {
|
|||
|
||||
} catch (IOException e) {
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("IOException in SwdResponse.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
@ -42,6 +44,8 @@ import com.google.gson.JsonObject;
|
|||
*/
|
||||
@Component("jsonXrdResponseView")
|
||||
public class XrdJsonResponse extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(XrdJsonResponse.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
|
@ -70,15 +74,6 @@ public class XrdJsonResponse extends AbstractView {
|
|||
|
||||
response.setContentType("application/json");
|
||||
|
||||
Writer out;
|
||||
try {
|
||||
out = response.getWriter();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return; // if we can't get the writer, this is pointless
|
||||
}
|
||||
|
||||
Map<String, String> links = (Map<String, String>) model.get("links");
|
||||
|
||||
JsonObject obj = new JsonObject();
|
||||
|
@ -94,7 +89,17 @@ public class XrdJsonResponse extends AbstractView {
|
|||
linksList.add(l);
|
||||
}
|
||||
|
||||
gson.toJson(obj, out);
|
||||
Writer out;
|
||||
|
||||
try {
|
||||
|
||||
out = response.getWriter();
|
||||
gson.toJson(obj, out);
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
logger.error("IOException in XrdJsonResponse.java: " + e.getStackTrace());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue