cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf-fediz git commit: Improving STS logging
Date Thu, 09 Apr 2015 15:06:43 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 9d7cdcde3 -> b2c792314


Improving STS logging


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

Branch: refs/heads/master
Commit: b2c792314f56f7f939b713ff4045a782a033f3eb
Parents: 9d7cdcd
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Apr 9 16:06:30 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Apr 9 16:06:30 2015 +0100

----------------------------------------------------------------------
 .../cxf/fediz/service/sts/FedizX509DelegationHandler.java    | 8 ++++++++
 .../cxf/fediz/service/sts/realms/IdentityMapperImpl.java     | 4 +++-
 .../apache/cxf/fediz/service/sts/realms/UriRealmParser.java  | 2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b2c79231/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizX509DelegationHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizX509DelegationHandler.java
b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizX509DelegationHandler.java
index 38c19b2..4c3107d 100644
--- a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizX509DelegationHandler.java
+++ b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizX509DelegationHandler.java
@@ -26,11 +26,16 @@ import org.apache.cxf.sts.token.delegation.TokenDelegationParameters;
 import org.apache.cxf.sts.token.delegation.TokenDelegationResponse;
 import org.apache.wss4j.dom.WSConstants;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * A delegation handler to allow X.509 Certificates.
  */
 public class FedizX509DelegationHandler implements TokenDelegationHandler {
     
+    private static final Logger LOG = LoggerFactory.getLogger(FedizX509DelegationHandler.class);
+    
     public boolean canHandleToken(ReceivedToken delegateTarget) {
         Object token = delegateTarget.getToken();
         if (token instanceof Element) {
@@ -55,6 +60,9 @@ public class FedizX509DelegationHandler implements TokenDelegationHandler
{
         
         if (delegateTarget.getState() == STATE.VALID && delegateTarget.getPrincipal()
!= null) {
             response.setDelegationAllowed(true);
+            LOG.debug("Delegation is allowed for: " + delegateTarget.getPrincipal());
+        } else {
+            LOG.debug("Delegation is not allowed, as the token is invalid or the principal
is null");
         }
         
         return response;

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b2c79231/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/IdentityMapperImpl.java
----------------------------------------------------------------------
diff --git a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/IdentityMapperImpl.java
b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/IdentityMapperImpl.java
index 474cc10..4640391 100644
--- a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/IdentityMapperImpl.java
+++ b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/IdentityMapperImpl.java
@@ -49,8 +49,10 @@ public class IdentityMapperImpl implements IdentityMapper {
             String name = sourcePrincipal.getName().toLowerCase();
             LOG.info("Principal '" + sourcePrincipal.getName() + "' mapped to '" + name);
             return new CustomTokenPrincipal(name);
+        } else {
+            LOG.info("The source realm of " + sourceRealm + " is unknown");
+            return null;
         }
-        return null;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b2c79231/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
----------------------------------------------------------------------
diff --git a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
index 1efe4b6..feebc7d 100644
--- a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
+++ b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
@@ -57,6 +57,8 @@ public class UriRealmParser implements RealmParser {
             LOG.warn("Unknown realm: " + realm);
             throw new STSException("Unknown realm: " + realm);
         }
+        
+        LOG.debug("URI realm parsed: " + realm);
         return realm;
     }
 


Mime
View raw message