cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Improve STS logging a bit
Date Thu, 09 Apr 2015 16:29:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes b46d0377a -> 2cfdd8e18


Improve STS logging a bit


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2cfdd8e1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2cfdd8e1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2cfdd8e1

Branch: refs/heads/3.0.x-fixes
Commit: 2cfdd8e188bdf2b5748aee945a84071de9cc38e0
Parents: b46d037
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Apr 9 16:35:12 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Apr 9 17:19:45 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/sts/operation/AbstractOperation.java | 8 ++++++++
 .../org/apache/cxf/sts/token/canceller/SCTCanceller.java     | 1 +
 .../cxf/sts/token/delegation/SAMLDelegationHandler.java      | 4 ++++
 .../org/apache/cxf/sts/token/provider/SAMLTokenProvider.java | 1 +
 .../java/org/apache/cxf/sts/token/provider/SCTProvider.java  | 1 +
 .../org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java   | 2 +-
 .../apache/cxf/sts/token/validator/SAMLTokenValidator.java   | 1 +
 .../org/apache/cxf/sts/token/validator/SCTValidator.java     | 1 +
 .../cxf/sts/token/validator/UsernameTokenValidator.java      | 1 +
 .../apache/cxf/sts/token/validator/X509TokenValidator.java   | 1 +
 10 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
index fd89371..4146a3f 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
@@ -604,6 +604,10 @@ public abstract class AbstractOperation {
         validatorParameters.setTokenRequirements(validateRequirements);
         validatorParameters.setToken(token);
 
+        if (tokenValidators.isEmpty()) {
+            LOG.fine("No token validators have been configured to validate the received token");
+        }
+        
         TokenValidatorResponse tokenResponse = null;
         for (TokenValidator tokenValidator : tokenValidators) {
             boolean canHandle = false;
@@ -627,6 +631,10 @@ public abstract class AbstractOperation {
                 break;
             }
         }
+        
+        if (tokenResponse == null) {
+            LOG.fine("No token validator has been configured to validate the received token");
+        }
         return tokenResponse;
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/canceller/SCTCanceller.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/canceller/SCTCanceller.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/canceller/SCTCanceller.java
index 7d146f7..6836cec 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/canceller/SCTCanceller.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/canceller/SCTCanceller.java
@@ -115,6 +115,7 @@ public class SCTCanceller implements TokenCanceller {
                 }
                 tokenParameters.getTokenStore().remove(token.getId());
                 cancelTarget.setState(STATE.CANCELLED);
+                LOG.fine("SecurityContextToken successfully cancelled");
             } catch (WSSecurityException ex) {
                 LOG.log(Level.WARNING, "", ex);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
index 2d7ca3b..963e28b 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
@@ -67,11 +67,15 @@ public class SAMLDelegationHandler implements TokenDelegationHandler {
         response.setToken(delegateTarget);
         
         if (delegateTarget.getState() != STATE.VALID || !delegateTarget.isDOMElement()) {
+            LOG.fine("Delegation token is not valid");
             return response;
         }
         
         if (isDelegationAllowed(delegateTarget, tokenParameters.getAppliesToAddress())) {
+            LOG.fine("Delegation is allowed for principal " + tokenParameters.getPrincipal());
             response.setDelegationAllowed(true);
+        } else {
+            LOG.fine("Delegation is not allowed for principal " + tokenParameters.getPrincipal());
         }
         
         return response;

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
index 892c22e..5837de5 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
@@ -169,6 +169,7 @@ public class SAMLTokenProvider implements TokenProvider {
             }
             response.setComputedKey(computedKey);
             
+            LOG.fine("SAML Token successfully created");
             return response;
         } catch (Exception e) {
             LOG.log(Level.WARNING, "", e);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
index 7c5d1b4..1f11c97 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
@@ -184,6 +184,7 @@ public class SCTProvider implements TokenProvider {
             unAttachedReference.setWsseValueType(tokenRequirements.getTokenType());
             response.setUnattachedReference(unAttachedReference);
             
+            LOG.fine("SecurityContextToken successfully created");
             return response;
         } catch (Exception e) {
             LOG.log(Level.WARNING, "", e);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
index 021ceb3..4165774 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
@@ -231,8 +231,8 @@ public class SAMLTokenRenewer implements TokenRenewer {
             response.setCreated(validFrom.toDate());
             response.setExpires(validTill.toDate());
 
+            LOG.fine("SAML Token successfully renewed");
             return response;
-            
         } catch (Exception ex) {
             LOG.log(Level.WARNING, "", ex);
             throw new STSException("Can't renew SAML assertion", ex, STSException.REQUEST_FAILED);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
index 0859749..90f9ea6 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
@@ -263,6 +263,7 @@ public class SAMLTokenValidator implements TokenValidator {
             response.setPrincipal(principal);
             
             validateTarget.setState(STATE.VALID);
+            LOG.fine("SAML Token successfully validated");
         } catch (WSSecurityException ex) {
             LOG.log(Level.WARNING, "", ex);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
index 1d10576..8ddf4ad 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
@@ -119,6 +119,7 @@ public class SCTValidator implements TokenValidator {
                     response.setTokenRealm(realm);
                 }
                 validateTarget.setState(STATE.VALID);
+                LOG.fine("SecurityContextToken successfully validated");
             } catch (WSSecurityException ex) {
                 LOG.log(Level.WARNING, "", ex);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
index b748f6a..14fb416 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
@@ -238,6 +238,7 @@ public class UsernameTokenValidator implements TokenValidator {
             response.setPrincipal(principal);
             response.setTokenRealm(tokenRealm);
             validateTarget.setState(STATE.VALID);
+            LOG.fine("Username Token successfully validated");
         } catch (WSSecurityException ex) {
             LOG.log(Level.WARNING, "", ex);
         } catch (Base64DecodingException ex) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2cfdd8e1/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java
index 823bd6e..4c68c44 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java
@@ -186,6 +186,7 @@ public class X509TokenValidator implements TokenValidator {
             }
             response.setPrincipal(principal);
             validateTarget.setState(STATE.VALID);
+            LOG.fine("X.509 Token successfully validated");
         } catch (WSSecurityException ex) {
             LOG.log(Level.WARNING, "", ex);
         }


Mime
View raw message