Repository: cxf-fediz Updated Branches: refs/heads/master 712b848d9 -> a7c8a5091
Log statements cleanup for Slf4J Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/a7c8a509 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/a7c8a509 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/a7c8a509 Branch: refs/heads/master Commit: a7c8a509171b9fa8817015a8d4164e8a242175d0 Parents: 712b848 Author: Oliver Wulff <[email protected]> Authored: Wed Mar 19 10:04:51 2014 +0100 Committer: Oliver Wulff <[email protected]> Committed: Wed Mar 19 10:04:51 2014 +0100 ---------------------------------------------------------------------- .../cxf/fediz/core/saml/SAMLTokenValidator.java | 35 ++------ .../fediz/jetty/FederationAuthenticator.java | 1 - .../cxf/fediz/spring/FederationConfigImpl.java | 6 +- .../web/FederationAuthenticationEntryPoint.java | 4 +- .../cxf/fediz/spring/FederationConfigImpl.java | 5 +- .../web/FederationAuthenticationEntryPoint.java | 8 +- .../was/mapper/FileBasedRoleToGroupMapper.java | 20 +---- .../filter/SecurityContextTTLChecker.java | 4 +- .../cxf/fediz/was/tai/FedizInterceptor.java | 88 +++++--------------- .../service/idp/STSAuthenticationProvider.java | 20 ++--- .../service/idp/beans/STSClientAction.java | 37 +++----- .../idp/beans/SigninParametersCacheAction.java | 8 +- .../TrustedIdpWSFedProtocolHandler.java | 12 +-- .../idp/rest/RestServiceExceptionMapper.java | 4 +- .../idp/service/jpa/ApplicationDAOJPAImpl.java | 12 +-- .../idp/service/jpa/ClaimDAOJPAImpl.java | 12 +-- .../idp/service/jpa/EntitlementDAOJPAImpl.java | 12 +-- .../service/idp/service/jpa/IdpDAOJPAImpl.java | 37 ++------ .../service/idp/service/jpa/RoleDAOJPAImpl.java | 23 ++--- 19 files changed, 91 insertions(+), 257 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java ---------------------------------------------------------------------- diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java index 478aaab..30dcf53 100644 --- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java +++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java @@ -153,10 +153,8 @@ public class SAMLTokenValidator implements TokenValidator { trusted = true; break; } catch (Exception ex) { - if (LOG.isDebugEnabled()) { - LOG.debug("Issuer '" + ti.getName() + "' not validated in keystore '" - + tm.getName() + "'"); - } + LOG.debug("Issuer '{}' not validated in keystore '{}'", + ti.getName(), tm.getName()); } } if (trusted) { @@ -253,26 +251,19 @@ public class SAMLTokenValidator implements TokenValidator { List<org.opensaml.saml1.core.AttributeStatement> attributeStatements = assertion .getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { - if (LOG.isDebugEnabled()) { - LOG.debug("No attribute statements found"); - } + LOG.debug("No attribute statements found"); return Collections.emptyList(); } List<Claim> collection = new ArrayList<Claim>(); Map<String, Claim> claimsMap = new HashMap<String, Claim>(); for (org.opensaml.saml1.core.AttributeStatement statement : attributeStatements) { - if (LOG.isDebugEnabled()) { - LOG.debug("parsing statement: " + statement.getElementQName()); - } + LOG.debug("parsing statement: {}", statement.getElementQName()); List<org.opensaml.saml1.core.Attribute> attributes = statement .getAttributes(); for (org.opensaml.saml1.core.Attribute attribute : attributes) { - if (LOG.isDebugEnabled()) { - LOG.debug("parsing attribute: " - + attribute.getAttributeName()); - } + LOG.debug("parsing attribute: {}", attribute.getAttributeName()); Claim c = new Claim(); c.setIssuer(assertion.getIssuer()); if (attribute.getAttributeNamespace() != null) { @@ -305,9 +296,7 @@ public class SAMLTokenValidator implements TokenValidator { for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent(); - if (LOG.isDebugEnabled()) { - LOG.debug(" [" + value + "]"); - } + LOG.debug(" [{}]", value); valueList.add(value); } mergeClaimToMap(claimsMap, c, valueList); @@ -324,9 +313,7 @@ public class SAMLTokenValidator implements TokenValidator { List<org.opensaml.saml2.core.AttributeStatement> attributeStatements = assertion .getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { - if (LOG.isDebugEnabled()) { - LOG.debug("No attribute statements found"); - } + LOG.debug("No attribute statements found"); return Collections.emptyList(); } @@ -334,9 +321,7 @@ public class SAMLTokenValidator implements TokenValidator { Map<String, Claim> claimsMap = new HashMap<String, Claim>(); for (org.opensaml.saml2.core.AttributeStatement statement : attributeStatements) { - if (LOG.isDebugEnabled()) { - LOG.debug("parsing statement: " + statement.getElementQName()); - } + LOG.debug("parsing statement: {}", statement.getElementQName()); List<org.opensaml.saml2.core.Attribute> attributes = statement .getAttributes(); for (org.opensaml.saml2.core.Attribute attribute : attributes) { @@ -361,9 +346,7 @@ public class SAMLTokenValidator implements TokenValidator { for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent(); - if (LOG.isDebugEnabled()) { - LOG.debug(" [" + value + "]"); - } + LOG.debug(" [{}]", value); valueList.add(value); } mergeClaimToMap(claimsMap, c, valueList); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java ---------------------------------------------------------------------- diff --git a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java index 1659aba..24bdddb 100644 --- a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java +++ b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java @@ -174,7 +174,6 @@ public class FederationAuthenticator extends LoginAuthenticator { if (wa.equals(FederationConstants.ACTION_SIGNIN)) { if (LOG.isDebugEnabled()) { LOG.debug("SignIn request found"); - LOG.debug("SignIn action..."); } if (wresult == null) { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java ---------------------------------------------------------------------- diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java index da032e0..4324103 100644 --- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java +++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java @@ -89,10 +89,8 @@ public class FederationConfigImpl implements FederationConfig, ServletContextAwa @Override public FederationContext getFederationContext() { if (servletContext != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("Reading federation configuration for context '" - + servletContext.getContextPath() + "'"); - } + LOG.debug("Reading federation configuration for context '{}'", + servletContext.getContextPath()); return getFederationContext(servletContext.getContextPath()); } else { Assert.notNull(contextName, "Property 'contextName' must be configured because ServletContext null"); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java ---------------------------------------------------------------------- diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java index dfd76cb..2696845 100644 --- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java +++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java @@ -76,9 +76,7 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo String redirectUrl = null; FederationContext fedContext = federationConfig.getFederationContext(); - if (LOG.isDebugEnabled()) { - LOG.debug("Federation context: " + fedContext); - } + LOG.debug("Federation context: {}", fedContext); try { FederationProcessor wfProc = new FederationProcessorImpl(); redirectUrl = wfProc.createSignInRequest(servletRequest, fedContext); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java ---------------------------------------------------------------------- diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java index ae9c873..95b8998 100644 --- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java +++ b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java @@ -89,10 +89,7 @@ public class FederationConfigImpl implements FederationConfig { @Override public FederationContext getFederationContext() { if (contextName != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("Reading federation configuration for context '" - + contextName + "'"); - } + LOG.debug("Reading federation configuration for context '{}'", contextName); return getFederationContext(contextName); } else { Assert.notNull(contextName, "Property 'contextName' must be configured because ServletContext null"); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java ---------------------------------------------------------------------- diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java index 2e4b765..a8a6184 100644 --- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java +++ b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java @@ -79,9 +79,7 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo String redirectUrl = null; FederationContext fedContext = federationConfig.getFederationContext(); - if (LOG.isDebugEnabled()) { - LOG.debug("Federation context: " + fedContext); - } + LOG.debug("Federation context: {}", fedContext); try { FederationProcessor wfProc = new FederationProcessorImpl(); redirectUrl = wfProc.createSignInRequest(servletRequest, fedContext); @@ -125,9 +123,7 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo HttpServletResponse hresponse = (HttpServletResponse)response; String redirectUrl = null; FederationContext fedContext = federationConfig.getFederationContext(); - if (LOG.isDebugEnabled()) { - LOG.debug("Federation context: " + fedContext); - } + LOG.debug("Federation context: {}", fedContext); try { FederationProcessor wfProc = new FederationProcessorImpl(); redirectUrl = wfProc.createSignInRequest(hrequest, fedContext); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/mapper/FileBasedRoleToGroupMapper.java ---------------------------------------------------------------------- diff --git a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/mapper/FileBasedRoleToGroupMapper.java b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/mapper/FileBasedRoleToGroupMapper.java index eec3a7b..19051c4 100644 --- a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/mapper/FileBasedRoleToGroupMapper.java +++ b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/mapper/FileBasedRoleToGroupMapper.java @@ -66,9 +66,7 @@ public class FileBasedRoleToGroupMapper implements RoleToGroupMapper { if (groupList != null) { groups.addAll(groupList); } else { - if (LOG.isDebugEnabled()) { - LOG.debug("missing group for role: " + key); - } + LOG.debug("missing group for role: {}", key); } } return groups; @@ -142,18 +140,12 @@ public class FileBasedRoleToGroupMapper implements RoleToGroupMapper { } } if (update) { - if (LOG.isDebugEnabled()) { - LOG.info("Mapping file has changed. Reloading..."); - } + LOG.info("Mapping file has changed. Reloading..."); Map<String, List<String>> newMap = loadMappingFile(); mappings.clear(); mappings.putAll(newMap); - if (LOG.isDebugEnabled()) { - LOG.info("Mapping file reloaded."); - } - - + LOG.info("Mapping file reloaded."); } } catch (FileNotFoundException e) { LOG.warn("Unable to load mappings due to: " + e.getMessage()); @@ -173,11 +165,7 @@ public class FileBasedRoleToGroupMapper implements RoleToGroupMapper { Iterator<SamlToJ2EE> i = localmappings.getSamlToJ2EE().iterator(); while (i.hasNext()) { SamlToJ2EE mapping = i.next(); - if (LOG.isDebugEnabled()) { - LOG.debug(mapping.getClaim() + " mapped to " - + mapping.getGroups().getJ2EeGroup().size() + " entries"); - - } + LOG.debug("{} mapped to {} entries", mapping.getClaim(), mapping.getGroups().getJ2EeGroup().size()); map.put(mapping.getClaim(), mapping.getGroups().getJ2EeGroup()); } http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/servlet/filter/SecurityContextTTLChecker.java ---------------------------------------------------------------------- diff --git a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/servlet/filter/SecurityContextTTLChecker.java b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/servlet/filter/SecurityContextTTLChecker.java index 8b300ac..fc08dce 100644 --- a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/servlet/filter/SecurityContextTTLChecker.java +++ b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/servlet/filter/SecurityContextTTLChecker.java @@ -102,9 +102,7 @@ public class SecurityContextTTLChecker extends HttpServlet implements Filter { if (el != null) { SecurityTokenThreadLocal.setToken(el); } - if (LOG.isDebugEnabled()) { - LOG.debug("Security token is still valid. Forwarding request"); - } + LOG.debug("Security token is still valid. Forwarding request"); } chain.doFilter(request, response); } catch (WSSecurityException e) { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java ---------------------------------------------------------------------- diff --git a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java index d5e7706..912be51 100644 --- a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java +++ b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java @@ -117,9 +117,7 @@ public class FedizInterceptor implements TrustAssociationInterceptor { * @param contextPath */ public static void registerContext(String contextPath) { - if (LOG.isDebugEnabled()) { - LOG.debug("Registering secured context-path: " + contextPath); - } + LOG.debug("Registering secured context-path: {}", contextPath); authorizedWebApps.add(contextPath); } @@ -133,9 +131,7 @@ public class FedizInterceptor implements TrustAssociationInterceptor { */ public static void deRegisterContext(String contextPath) { if (authorizedWebApps.contains(contextPath)) { - if (LOG.isDebugEnabled()) { - LOG.debug("De-registering secured context-path " + contextPath); - } + LOG.debug("De-registering secured context-path {}", contextPath); synchronized (authorizedWebApps) { authorizedWebApps.remove(contextPath); } @@ -154,10 +150,7 @@ public class FedizInterceptor implements TrustAssociationInterceptor { if (roleGroupMapper != null && !roleGroupMapper.isEmpty()) { try { mapper = (RoleToGroupMapper)Class.forName(roleGroupMapper).newInstance(); - if (LOG.isDebugEnabled()) { - LOG.debug("Using the " + roleGroupMapper + " mapper class"); - } - + LOG.debug("Using the {} mapper class", roleGroupMapper); mapper.initialize(props); } catch (Exception e) { throw new TAIConfigurationException( @@ -167,24 +160,18 @@ public class FedizInterceptor implements TrustAssociationInterceptor { } } else { mapper = new DefaultRoleToGroupMapper(); - if (LOG.isDebugEnabled()) { - LOG.debug("Using the DefaultRoleToGroupMapper mapper class"); - } + LOG.debug("Using the DefaultRoleToGroupMapper mapper class"); } String configFileLocation = props.getProperty(Constants.CONFIGURATION_FILE_PARAMETER); if (configFileLocation != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("Configuration file location set to " + configFileLocation); - } + LOG.debug("Configuration file location set to {}", configFileLocation); File f = new File(configFileLocation); configurator = new FederationConfigurator(); configurator.loadConfig(f); - if (LOG.isDebugEnabled()) { - LOG.debug("Federation config loaded from path : " + configFileLocation); - } + LOG.debug("Federation config loaded from path: {}", configFileLocation); } else { throw new WebTrustAssociationFailedException("Missing required initialization parameter " + Constants.CONFIGURATION_FILE_PARAMETER); @@ -213,15 +200,13 @@ public class FedizInterceptor implements TrustAssociationInterceptor { */ @Override public boolean isTargetInterceptor(HttpServletRequest req) throws WebTrustAssociationException { - if (LOG.isDebugEnabled()) { - LOG.debug("Request URI: " + req.getRequestURI()); - } + LOG.debug("Request URI: {}", req.getRequestURI()); FederationContext context = getFederationContext(req); if (context != null) { return true; } else { - LOG.warn("No Federation Context configured for context-path " + req.getContextPath()); + LOG.warn("No Federation Context configured for context-path {}", req.getContextPath()); } return false; } @@ -236,13 +221,11 @@ public class FedizInterceptor implements TrustAssociationInterceptor { public TAIResult negotiateValidateandEstablishTrust(HttpServletRequest req, HttpServletResponse resp) throws WebTrustAssociationFailedException { - if (LOG.isDebugEnabled()) { - LOG.debug("Request URI: " + req.getRequestURI()); - } + LOG.debug("Request URI: {}", req.getRequestURI()); FederationContext fedCtx = getFederationContext(req); if (fedCtx == null) { - LOG.warn("No Federation Context configured for context-path " + req.getContextPath()); + LOG.warn("No Federation Context configured for context-path {}", req.getContextPath()); return TAIResult.create(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } @@ -270,28 +253,19 @@ public class FedizInterceptor implements TrustAssociationInterceptor { private TAIResult handleSignIn(HttpServletRequest req, HttpServletResponse resp) throws ProcessingException, IOException, WebTrustAssociationFailedException, Exception { if (req.getMethod().equals(Constants.HTTP_POST_METHOD)) { - if (LOG.isDebugEnabled()) { - LOG.debug("Sign-In-Response received"); - } + LOG.debug("Sign-In-Response received"); String wresult = req.getParameter(FederationConstants.PARAM_RESULT); String wctx = req.getParameter(FederationConstants.PARAM_CONTEXT); if (wresult != null && wctx != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("Validating RSTR..."); - } + LOG.debug("Validating RSTR..."); // process and validate the token FederationResponse federationResponse = processSigninRequest(req, resp); - - if (LOG.isInfoEnabled()) { - LOG.info("RSTR validated successfully"); - } + LOG.info("RSTR validated successfully"); HttpSession session = req.getSession(true); session.setAttribute(Constants.SECURITY_TOKEN_SESSION_ATTRIBUTE_KEY, federationResponse); - if (LOG.isInfoEnabled()) { - LOG.info("Redirecting request to " + wctx); - } + LOG.info("Redirecting request to {}", wctx); resp.sendRedirect(wctx); return TAIResult.create(HttpServletResponse.SC_FOUND); } else { @@ -306,30 +280,22 @@ public class FedizInterceptor implements TrustAssociationInterceptor { WebTrustAssociationFailedException, Exception { HttpSession session = req.getSession(false); if (session == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("No session found. Sending a token request"); - } + LOG.debug("No session found. Sending a token request"); redirectToIdp(req, resp); return TAIResult.create(HttpServletResponse.SC_FOUND); } else { - if (LOG.isDebugEnabled()) { - LOG.debug("Session ID is " + session.getId()); - } + LOG.debug("Session ID is {}", session.getId()); FederationResponse federationResponse = (FederationResponse)session .getAttribute(Constants.SECURITY_TOKEN_SESSION_ATTRIBUTE_KEY); if (federationResponse != null) { - if (LOG.isInfoEnabled()) { - LOG.info("Security Token found in session: " + federationResponse.getUsername()); - } + LOG.info("Security Token found in session: {}", federationResponse.getUsername()); TAIResult result = null; // check that the target WebApp is properly configured for Token TTL enforcement if (authorizedWebApps.contains(req.getContextPath())) { - if (LOG.isDebugEnabled()) { - LOG.info("Security Filter properly configured - forwarding subject"); - } + LOG.info("Security Filter properly configured - forwarding subject"); // proceed creating the JAAS Subject List<String> groupsIds = groupIdsFromTokenRoles(federationResponse); @@ -338,15 +304,13 @@ public class FedizInterceptor implements TrustAssociationInterceptor { result = TAIResult.create(HttpServletResponse.SC_OK, "ignore", subject); } else { result = TAIResult.create(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - LOG.warn("No Security Filter configured for " + req.getContextPath()); + LOG.warn("No Security Filter configured for {}", req.getContextPath()); } // leave the Session untouched session.removeAttribute(Constants.SECURITY_TOKEN_SESSION_ATTRIBUTE_KEY); return result; } else { - if (LOG.isInfoEnabled()) { - LOG.info("No Subject found in existing session. Redirecting to IDP"); - } + LOG.info("No Subject found in existing session. Redirecting to IDP"); redirectToIdp(req, resp); return TAIResult.create(HttpServletResponse.SC_FOUND); } @@ -404,14 +368,10 @@ public class FedizInterceptor implements TrustAssociationInterceptor { List<String> groupIds = new ArrayList<String>(1); if (localGroups != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("Converting " + localGroups.size() + " group names to uids"); - } + LOG.debug("Converting {} group names to uids", localGroups.size()); for (String localGroup : localGroups) { String guid = convertGroupNameToUniqueId(reg, localGroup); - if (LOG.isDebugEnabled()) { - LOG.debug("Group '" + localGroup + "' maps to guid: " + guid); - } + LOG.debug("Group '{}' maps to guid: {}", localGroup, guid); groupIds.add(guid); } } @@ -449,9 +409,7 @@ public class FedizInterceptor implements TrustAssociationInterceptor { subject.getPublicCredentials().add(map); - if (LOG.isDebugEnabled()) { - LOG.debug("Subject credentials: " + map.toString()); - } + LOG.debug("Subject credentials: {}", map.toString()); return subject; } http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java index 265b29e..3946fd0 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java @@ -157,9 +157,7 @@ public class STSAuthenticationProvider implements AuthenticationProvider { token); upat.setDetails(details); - if (LOG.isDebugEnabled()) { - LOG.debug("[IDP_TOKEN=" + token.getId() + "] provided for user '" + authentication.getName() + "'"); - } + LOG.debug("[IDP_TOKEN={}] provided for user '{}'", token.getId(), authentication.getName()); return upat; } catch (Exception ex) { LOG.info("Failed to authenticate user '" + authentication.getName() + "'", ex); @@ -242,9 +240,7 @@ public class STSAuthenticationProvider implements AuthenticationProvider { List<org.opensaml.saml2.core.AttributeStatement> attributeStatements = assertion .getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { - if (LOG.isDebugEnabled()) { - LOG.debug("No attribute statements found"); - } + LOG.debug("No attribute statements found"); return Collections.emptyList(); } @@ -252,15 +248,11 @@ public class STSAuthenticationProvider implements AuthenticationProvider { Map<String, Claim> claimsMap = new HashMap<String, Claim>(); for (org.opensaml.saml2.core.AttributeStatement statement : attributeStatements) { - if (LOG.isDebugEnabled()) { - LOG.debug("parsing statement: " + statement.getElementQName()); - } + LOG.debug("parsing statement: {}", statement.getElementQName()); List<org.opensaml.saml2.core.Attribute> attributes = statement .getAttributes(); for (org.opensaml.saml2.core.Attribute attribute : attributes) { - if (LOG.isDebugEnabled()) { - LOG.debug("parsing attribute: " + attribute.getName()); - } + LOG.debug("parsing attribute: {}", attribute.getName()); Claim c = new Claim(); // Workaround for CXF-4484 // Value of Attribute Name not fully qualified @@ -279,9 +271,7 @@ public class STSAuthenticationProvider implements AuthenticationProvider { for (XMLObject attributeValue : attribute.getAttributeValues()) { Element attributeValueElement = attributeValue.getDOM(); String value = attributeValueElement.getTextContent(); - if (LOG.isDebugEnabled()) { - LOG.debug(" [" + value + "]"); - } + LOG.debug(" [{}]", value); valueList.add(value); } mergeClaimToMap(claimsMap, c, valueList); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java index 2a03cb3..4439033 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java @@ -207,9 +207,7 @@ public class STSClientAction { sts.setWspNamespace(serviceConfig.getPolicyNamespace()); } - if (LOG.isDebugEnabled()) { - LOG.debug("TokenType " + sts.getTokenType() + " set for " + wtrealm); - } + LOG.debug("TokenType {} set for realm {}", sts.getTokenType(), wtrealm); sts.setKeyType(keyType); if (HTTP_DOCS_OASIS_OPEN_ORG_WS_SX_WS_TRUST_200512_PUBLICKEY.equals(keyType)) { @@ -237,9 +235,7 @@ public class STSClientAction { if (serviceConfig.getRequestedClaims() != null && serviceConfig.getRequestedClaims().size() > 0) { addClaims(sts, serviceConfig.getRequestedClaims()); - if (LOG.isDebugEnabled()) { - LOG.debug("Requested claims set for " + wtrealm); - } + LOG.debug("Requested claims set for {}", wtrealm); } sts.setEnableLifetime(true); @@ -248,9 +244,7 @@ public class STSClientAction { int lifetime = serviceConfig.getLifeTime(); sts.setTtl(lifetime); sts.setEnableLifetime(lifetime > 0); - if (LOG.isDebugEnabled()) { - LOG.debug("Lifetime set to " + serviceConfig.getLifeTime() + " seconds for " + wtrealm); - } + LOG.debug("Lifetime set to {} seconds for realm {}", serviceConfig.getLifeTime(), wtrealm); } catch (NumberFormatException ex) { LOG.warn("Invalid lifetime configured for service provider " + wtrealm); sts.setTtl(this.ttl); @@ -260,7 +254,7 @@ public class STSClientAction { sts.setTtl(this.ttl); sts.setEnableLifetime(this.ttl > 0); if (LOG.isDebugEnabled()) { - LOG.debug("Lifetime set to " + this.ttl + " seconds for " + wtrealm); + LOG.debug("Lifetime set to {} seconds for realm {}", this.ttl, wtrealm); } } @@ -268,7 +262,7 @@ public class STSClientAction { sts.setOnBehalfOf(idpToken.getToken()); if (!(serviceConfig.getProtocol() == null || FederationConstants.WS_FEDERATION_NS.equals(serviceConfig.getProtocol()))) { - LOG.error("Protocol " + serviceConfig.getProtocol() + " not supported for " + wtrealm); + LOG.error("Protocol {} not supported for realm {} ", serviceConfig.getProtocol(), wtrealm); throw new ProcessingException(TYPE.BAD_REQUEST); } @@ -284,9 +278,8 @@ public class STSClientAction { SamlAssertionWrapper aw = new SamlAssertionWrapper(e); String id = aw.getId(); - LOG.info("[RP_TOKEN=" + id + "] successfully created for realm [" - + wtrealm + "] on behalf of [IDP_TOKEN=" + idpToken.getId() - + "]"); + LOG.info("[RP_TOKEN={}] successfully created for realm [{}] on behalf of [IDP_TOKEN={}]", + id, wtrealm, idpToken.getId()); return StringEscapeUtils.escapeXml(rpToken); } @@ -296,12 +289,8 @@ public class STSClientAction { SecurityToken idpToken = (SecurityToken) WebUtils.getAttributeFromFlowScope(context, "idpToken"); if (idpToken != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("[IDP_TOKEN=" - + idpToken.getId() - + "] successfully retrieved from cache for home realm [" - + whr + "]"); - } + LOG.debug("[IDP_TOKEN={} successfully retrieved from cache for home realm [{}]", + idpToken.getId(), whr); } else { LOG.error("IDP_TOKEN not found"); throw new ProcessingException(TYPE.BAD_REQUEST); @@ -318,9 +307,9 @@ public class STSClientAction { WebUtils.getHttpServletRequest(context).getLocalPort(), url.getFile()); setSTSWsdlUrl(updatedUrl.toString()); - LOG.info("STS WSDL URL updated to " + updatedUrl.toString()); + LOG.info("STS WSDL URL updated to {}", updatedUrl.toString()); } catch (MalformedURLException e) { - LOG.error("Invalid Url '" + this.wsdlLocation + "': " + e.getMessage()); + LOG.error("Invalid Url '{}': {}", this.wsdlLocation, e.getMessage()); } } } @@ -350,9 +339,7 @@ public class STSClientAction { if (realmClaims != null && realmClaims.size() > 0) { for (RequestClaim item : realmClaims) { - if (LOG.isDebugEnabled()) { - LOG.debug(" " + item.getClaimType().toString()); - } + LOG.debug(" {}", item.getClaimType().toString()); writer.writeStartElement("ic", "ClaimType", HTTP_SCHEMAS_XMLSOAP_ORG_WS_2005_05_IDENTITY); writer.writeAttribute("Uri", item.getClaimType().toString()); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java index c25475b..636bcb2 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java @@ -58,9 +58,7 @@ public class SigninParametersCacheAction { } WebUtils.putAttributeInExternalContext(context, uuidKey, signinParams); - if (LOG.isDebugEnabled()) { - LOG.debug("SignIn parameters cached: " + signinParams.toString() + "."); - } + LOG.debug("SignIn parameters cached: {}", signinParams.toString()); WebUtils.putAttributeInFlowScope(context, FederationConstants.PARAM_CONTEXT, uuidKey); LOG.info("SignIn parameters cached and " + FederationConstants.PARAM_CONTEXT + " set to [" + uuidKey + "]."); } @@ -85,9 +83,7 @@ public class SigninParametersCacheAction { WebUtils.putAttributeInFlowScope(context, FederationConstants.PARAM_HOME_REALM, value); } - if (LOG.isDebugEnabled()) { - LOG.debug("SignIn parameters restored: " + signinParams.toString() + "."); - } + LOG.debug("SignIn parameters restored: {}", signinParams.toString()); WebUtils.removeAttributeFromFlowScope(context, FederationConstants.PARAM_CONTEXT); LOG.info("SignIn parameters restored and " + FederationConstants.PARAM_CONTEXT + "[" + uuidKey + "] cleared."); } http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java index b572af7..3b909a8 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java @@ -158,14 +158,10 @@ public class TrustedIdpWSFedProtocolHandler implements TrustedIdpProtocolHandler wfResp.getTokenCreated(), wfResp.getTokenExpires()); idpToken.setToken(e); - LOG.info("[IDP_TOKEN=" + id + "] for user '" + wfResp.getUsername() - + "' created from [RP_TOKEN=" + wfResp.getUniqueTokenId() - + "] issued by home realm [" + whr + "/" - + wfResp.getIssuer() + "]."); - if (LOG.isDebugEnabled()) { - LOG.debug("Created date=" + wfResp.getTokenCreated()); - LOG.debug("Expired date=" + wfResp.getTokenExpires()); - } + LOG.info("[IDP_TOKEN={}] for user '{}' created from [RP_TOKEN={}] issued by home realm [{}/{}]", + id, wfResp.getUsername(), wfResp.getUniqueTokenId(), whr, wfResp.getIssuer()); + LOG.debug("Created date={}", wfResp.getTokenCreated()); + LOG.debug("Expired date={}", wfResp.getTokenExpires()); if (LOG.isDebugEnabled()) { LOG.debug("Validated 'wresult' : " + System.getProperty("line.separator") + wresult); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java index fc01aee..c7a1e1e 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java @@ -54,9 +54,7 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception> { } if (ex instanceof ConstraintViolationException) { ConstraintViolationException cve = (ConstraintViolationException)ex; - if (LOG.isDebugEnabled()) { - LOG.debug(ex.getMessage() + "\n" + cve.getConstraintViolations().toString()); - } + LOG.debug("{}\n{}", ex.getMessage(), cve.getConstraintViolations().toString()); return buildResponse(Response.Status.BAD_REQUEST, ex); } if (ex instanceof DataIntegrityViolationException) { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java index e84543e..17499fe 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java @@ -88,9 +88,7 @@ public class ApplicationDAOJPAImpl implements ApplicationDAO { domain2entity(application, entity); em.persist(entity); - if (LOG.isDebugEnabled()) { - LOG.debug("Application '" + application.getRealm() + "' added"); - } + LOG.debug("Application '{}' added", application.getRealm()); return entity2domain(entity, Arrays.asList("all")); } @@ -107,9 +105,7 @@ public class ApplicationDAOJPAImpl implements ApplicationDAO { em.persist(applicationEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Application '" + realm + "' updated"); - } + LOG.debug("Application '{}' updated", realm); } @@ -123,9 +119,7 @@ public class ApplicationDAOJPAImpl implements ApplicationDAO { Object applObj = query.getSingleResult(); em.remove(applObj); - if (LOG.isDebugEnabled()) { - LOG.debug("Application '" + realm + "' deleted"); - } + LOG.debug("Application '{}' deleted", realm); } http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java index 348781a..b18ae8e 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java @@ -75,9 +75,7 @@ public class ClaimDAOJPAImpl implements ClaimDAO { domain2entity(claim, entity); em.persist(entity); - if (LOG.isDebugEnabled()) { - LOG.debug("Claim '" + claim.getClaimType() + "' added"); - } + LOG.debug("Claim '{}' added", claim.getClaimType()); return entity2domain(entity); } @@ -97,9 +95,7 @@ public class ClaimDAOJPAImpl implements ClaimDAO { domain2entity(claim, claimEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Claim '" + claim.getClaimType() + "' added"); - } + LOG.debug("Claim '{}' added", claim.getClaimType()); em.persist(claimEntity); } @@ -113,9 +109,7 @@ public class ClaimDAOJPAImpl implements ClaimDAO { Object claimObj = query.getSingleResult(); em.remove(claimObj); - if (LOG.isDebugEnabled()) { - LOG.debug("Claim '" + claimType + "' deleted"); - } + LOG.debug("Claim '{}' deleted", claimType); } static ClaimEntity getClaimEntity(String claimType, EntityManager em) { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java index 0e7bf79..3e76da0 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java @@ -74,9 +74,7 @@ public class EntitlementDAOJPAImpl implements EntitlementDAO { domain2entity(entitlement, entity); em.persist(entity); - if (LOG.isDebugEnabled()) { - LOG.debug("Entitlement '" + entitlement.getName() + "' added"); - } + LOG.debug("Entitlement '{}' added", entitlement.getName()); return entity2domain(entity); } @@ -96,9 +94,7 @@ public class EntitlementDAOJPAImpl implements EntitlementDAO { domain2entity(entitlement, entitlementEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Entitlement '" + entitlement.getName() + "' added"); - } + LOG.debug("Entitlement '{}' added", entitlement.getName()); em.persist(entitlementEntity); } @@ -112,9 +108,7 @@ public class EntitlementDAOJPAImpl implements EntitlementDAO { Object entitlementObj = query.getSingleResult(); em.remove(entitlementObj); - if (LOG.isDebugEnabled()) { - LOG.debug("Entitlement '" + name + "' deleted"); - } + LOG.debug("Entitlement '{}' deleted", name); } static EntitlementEntity getEntitlementEntity(String name, EntityManager em) { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java index 6231a3c..b27ce24 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java @@ -93,9 +93,7 @@ public class IdpDAOJPAImpl implements IdpDAO { domain2entity(idp, entity); em.persist(entity); - if (LOG.isDebugEnabled()) { - LOG.debug("IDP '" + idp.getRealm() + "' added"); - } + LOG.debug("IDP '{}' added", idp.getRealm()); return entity2domain(entity, Arrays.asList("all")); } @@ -112,9 +110,7 @@ public class IdpDAOJPAImpl implements IdpDAO { em.persist(idpEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("IDP '" + idp.getRealm() + "' updated"); - } + LOG.debug("IDP '{}' updated", idp.getRealm()); } @Override @@ -127,10 +123,7 @@ public class IdpDAOJPAImpl implements IdpDAO { Object idpObj = query.getSingleResult(); em.remove(idpObj); - if (LOG.isDebugEnabled()) { - LOG.debug("IDP '" + realm + "' deleted"); - } - + LOG.debug("IDP '{}' deleted", realm); } @Override @@ -151,9 +144,7 @@ public class IdpDAOJPAImpl implements IdpDAO { idpEntity.getApplications().add(applicationEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Application '" + application.getRealm() + "' added to IDP '" + idp.getRealm() + "'"); - } + LOG.debug("Application '{}' added to IDP '{}'", application.getRealm(), idp.getRealm()); } @Override @@ -180,9 +171,7 @@ public class IdpDAOJPAImpl implements IdpDAO { throw new EntityNotFoundException("ApplicationEntity not assigned to IdpEntity"); } - if (LOG.isDebugEnabled()) { - LOG.debug("Application '" + application.getRealm() + "' removed from IDP '" + idp.getRealm() + "'"); - } + LOG.debug("Application '{}' removed from IDP '{}'", application.getRealm(), idp.getRealm()); } @Override @@ -203,9 +192,7 @@ public class IdpDAOJPAImpl implements IdpDAO { idpEntity.getTrustedIdps().add(trustedIdpEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Trusted IDP '" + trustedIdp.getRealm() + "' added to IDP '" + idp.getRealm() + "'"); - } + LOG.debug("Trusted IDP '{}' added to IDP '{}'", trustedIdp.getRealm(), idp.getRealm()); } @Override @@ -226,9 +213,7 @@ public class IdpDAOJPAImpl implements IdpDAO { idpEntity.getTrustedIdps().remove(trustedIdpEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Trusted IDP '" + trustedIdp.getRealm() + "' removed from IDP '" + idp.getRealm() + "'"); - } + LOG.debug("Trusted IDP '{}' removed from IDP '{}'", trustedIdp.getRealm(), idp.getRealm()); } @Override @@ -249,9 +234,7 @@ public class IdpDAOJPAImpl implements IdpDAO { idpEntity.getClaimTypesOffered().add(claimEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Claim '" + claim.getClaimType() + "' added to IDP '" + idp.getRealm() + "'"); - } + LOG.debug("Claim '{}' added to IDP '{}'", claim.getClaimType(), idp.getRealm()); } @Override @@ -280,9 +263,7 @@ public class IdpDAOJPAImpl implements IdpDAO { throw new EntityNotFoundException("ClaimEntity not assigned to IdpEntity"); } - if (LOG.isDebugEnabled()) { - LOG.debug("Claim '" + claim.getClaimType() + "' removed from IDP '" + idp.getRealm() + "'"); - } + LOG.debug("Claim '{}' removed from IDP '{}'", claim.getClaimType(), idp.getRealm()); } static IdpEntity getIdpEntity(String realm, EntityManager em) { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a7c8a509/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java index dd47fa6..30ec39e 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java @@ -86,9 +86,7 @@ public class RoleDAOJPAImpl implements RoleDAO { domain2entity(role, entity); em.persist(entity); - if (LOG.isDebugEnabled()) { - LOG.debug("Role '" + role.getName() + "' added"); - } + LOG.debug("Role '{}' added", role.getName()); return entity2domain(entity, Arrays.asList("all")); } @@ -105,9 +103,7 @@ public class RoleDAOJPAImpl implements RoleDAO { em.persist(roleEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Role '" + role.getName() + "' updated"); - } + LOG.debug("Role '{}' updated", role.getName()); } @Override @@ -120,10 +116,7 @@ public class RoleDAOJPAImpl implements RoleDAO { Object roleObj = query.getSingleResult(); em.remove(roleObj); - if (LOG.isDebugEnabled()) { - LOG.debug("Role '" + name + "' deleted"); - } - + LOG.debug("Role '{}' deleted", name); } @Override @@ -144,9 +137,7 @@ public class RoleDAOJPAImpl implements RoleDAO { roleEntity.getEntitlements().add(entitlementEntity); - if (LOG.isDebugEnabled()) { - LOG.debug("Entitlement '" + entitlement.getName() + "' added to Role '" + role.getName() + "'"); - } + LOG.debug("Entitlement '{}' added to Role '{}'", entitlement.getName(), role.getName()); } @Override @@ -172,10 +163,8 @@ public class RoleDAOJPAImpl implements RoleDAO { if (!roleEntity.getEntitlements().remove(entitlementEntity)) { throw new EntityNotFoundException("EntitlementEntity not assigned to RoleEntity"); } - - if (LOG.isDebugEnabled()) { - LOG.debug("Entitlement '" + entitlement.getName() + "' removed from Role '" + role.getName() + "'"); - } + + LOG.debug("Entitlement '{}' removed from Role '{}'", entitlement.getName(), role.getName()); } static RoleEntity getRoleEntity(String realm, EntityManager em) {
