[java-oidc-common] branch main updated: Improve logging

Phil Smart philip.smart at jisc.ac.uk
Mon Mar 13 11:13:09 UTC 2023


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=d28b0682421f3029a999e4adb6c5ba6a6644d59f

The following commit(s) were added to refs/heads/main by this push:
     new d28b068  Improve logging
d28b068 is described below

commit d28b0682421f3029a999e4adb6c5ba6a6644d59f
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Mar 13 11:13:03 2023 +0000

    Improve logging
---
 .../shibboleth/oidc/security/impl/DecryptJWE.java  |  2 +-
 .../impl/DefaultEncryptionParametersResolver.java  | 23 ++++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java
index 920c48c..e1d25ea 100644
--- a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java
+++ b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java
@@ -187,7 +187,7 @@ public class DecryptJWE extends AbstractProfileAction {
      */
     private void logJWT(@Nonnull final JWT jwt) {
         try {
-            log.trace("{} Decrypted JWT: {}", getLogPrefix(), jwt.getJWTClaimsSet().toString());
+            log.trace("{} Decrypted JWT: {}", getLogPrefix(), jwt.getJWTClaimsSet());
         } catch (final IllegalStateException | ParseException e) {
             log.trace("{} Unable to print decrypted JWT: {}", getLogPrefix(), e.getMessage());
         }        
diff --git a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jose/impl/DefaultEncryptionParametersResolver.java b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jose/impl/DefaultEncryptionParametersResolver.java
index f6115b8..4495296 100644
--- a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jose/impl/DefaultEncryptionParametersResolver.java
+++ b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jose/impl/DefaultEncryptionParametersResolver.java
@@ -439,7 +439,7 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
             @Nonnull final CriteriaSet criteria, @Nonnull final List<EncryptionMethod> dataEncryptionAlgorithms, 
             @Nonnull final JWEAlgorithm algorithm) {
         
-        
+        log.debug("Looking for encryption parameters for algorithm '{}'", algorithm);
         for (final EncryptionMethod method : dataEncryptionAlgorithms) {
             
             // Resolution must occur for each 'enc' method tested, as the derived direct encryption could be different 
@@ -447,7 +447,7 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
             final CriteriaSet credentialCriteria = buildEncryptionKeyAlgorithmCriteria(criteria, algorithm, method);
             
             final List<Credential> dataEncryptionCredentials= getEffectiveDataEncryptionCredentials(credentialCriteria);
-            log.trace("Resolved {} possible direct encryption credential(s) for 'alg={}' and 'enc={}'", 
+            log.debug("Resolved {} possible direct encryption credential(s) for 'alg={}' and 'enc={}'", 
                     dataEncryptionCredentials.size(), algorithm.getName(), method.getName()); 
             
             for (final Credential credential : dataEncryptionCredentials) {
@@ -455,7 +455,7 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
                 if (checkCredentialSupportsAlgorithm(credential, algorithm) && 
                         checkCredentialSupportsEncryptionMethod(credential, method)) {                      
                     if (log.isDebugEnabled()) {
-                        log.debug("Resolved key from '{}' for 'alg={}' and 'enc={}'", 
+                        log.debug("Resolved compatible key '{}' for 'alg={}' and 'enc={}'", 
                                 CredentialConversionUtil.resolveKid(credential),
                                 algorithm.getName(), method.getName());
                     }
@@ -467,6 +467,7 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
                 }
             }
         }
+        log.debug("No resolved credentials are compatible with algorithm '{}'", algorithm);
         return false;
     }
     
@@ -486,20 +487,20 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
             @Nonnull final CriteriaSet criteria, @Nonnull final List<EncryptionMethod> dataEncryptionAlgorithms, 
             @Nonnull final JWEAlgorithm algorithm) {
         
-        
+        log.debug("Looking for encryption parameters for algorithm '{}'", algorithm);
         for (final EncryptionMethod method : dataEncryptionAlgorithms) {
             
             final CriteriaSet credentialCriteria = buildKeyManagmentAlgorithmCriteria(criteria, algorithm, method);
      
             final List<Credential> keyTransportCredentials = getEffectiveKeyTransportCredentials(credentialCriteria);
-            log.trace("Resolved {} possible key transport credentials for 'alg={}' and 'enc={}'", 
+            log.debug("Resolved {} possible key transport credentials for 'alg={}' and 'enc={}'", 
                     keyTransportCredentials.size(), algorithm.getName(), method.getName());
             
             for (final Credential credential : keyTransportCredentials) {
 
                 if (checkCredentialSupportsAlgorithm(credential, algorithm)) {                      
                     if (log.isDebugEnabled()) {
-                        log.debug("Resolved key from '{}' for 'alg={}' and 'enc={}'", 
+                        log.debug("Resolved compatible key '{}' for 'alg={}' and 'enc={}'", 
                                 CredentialConversionUtil.resolveKid(credential),
                                 algorithm.getName(), method.getName());
                     }
@@ -511,6 +512,7 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
                 }
             }
         }
+        log.debug("No resolved credentials are compatible with algorithm '{}'", algorithm);
         return false;          
     }
     
@@ -526,20 +528,20 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
             @Nonnull final CriteriaSet criteria,  @Nonnull final List<EncryptionMethod> dataEncryptionAlgorithms, 
             @Nonnull final JWEAlgorithm algorithm) {
         
-        
+        log.debug("Looking for encryption parameters for algorithm '{}'", algorithm);
         final EncryptionMethod encryptionMethod = resolveEncryptionMethod(dataEncryptionAlgorithms);
         
         final List<Credential> keyTransportCredentials = getEffectiveKeyTransportCredentials(
                 buildKeyManagmentAlgorithmCriteria(criteria, algorithm, encryptionMethod));
         
-        log.trace("Resolved {} possible key transport credentials for 'alg={}'", 
+        log.debug("Resolved {} possible key transport credentials for 'alg={}'", 
                 keyTransportCredentials.size(), algorithm.getName());
 
         for (final Credential credential : keyTransportCredentials) {
 
             if (checkCredentialSupportsAlgorithm(credential, algorithm)) {                      
                 if (log.isDebugEnabled()) {
-                    log.debug("Resolved key from '{}' for 'alg={}' and 'enc={}'", 
+                    log.debug("Resolved compatible key '{}' for 'alg={}' and 'enc={}'", 
                             CredentialConversionUtil.resolveKid(credential),
                             algorithm.getName(), encryptionMethod.getName());
                 }
@@ -549,7 +551,8 @@ public class DefaultEncryptionParametersResolver extends AbstractSecurityParamet
                 params.setDataEncryptionAlgorithm(encryptionMethod.getName());  
                 return true;
             }
-        }        
+        } 
+        log.debug("No resolved credentials are compatible with algorithm '{}'", algorithm);
         return false;          
     }
     

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list