|
@@ -49,6 +49,8 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecret
|
|
|
import org.apache.hadoop.util.HttpExceptionUtils;
|
|
|
import org.apache.hadoop.util.StringUtils;
|
|
|
import org.codehaus.jackson.map.ObjectMapper;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
|
|
@@ -77,6 +79,8 @@ import com.google.common.annotations.VisibleForTesting;
|
|
|
@InterfaceStability.Evolving
|
|
|
public abstract class DelegationTokenAuthenticationHandler
|
|
|
implements AuthenticationHandler {
|
|
|
+ private static final Logger LOG =
|
|
|
+ LoggerFactory.getLogger(DelegationTokenAuthenticationHandler.class);
|
|
|
|
|
|
protected static final String TYPE_POSTFIX = "-dt";
|
|
|
|
|
@@ -190,6 +194,7 @@ public abstract class DelegationTokenAuthenticationHandler
|
|
|
HttpServletRequest request, HttpServletResponse response)
|
|
|
throws IOException, AuthenticationException {
|
|
|
boolean requestContinues = true;
|
|
|
+ LOG.trace("Processing operation for req=({}), token: {}", request, token);
|
|
|
String op = ServletUtils.getParameter(request,
|
|
|
KerberosDelegationTokenAuthenticator.OP_PARAM);
|
|
|
op = (op != null) ? StringUtils.toUpperCase(op) : null;
|
|
@@ -202,6 +207,7 @@ public abstract class DelegationTokenAuthenticationHandler
|
|
|
if (dtOp.requiresKerberosCredentials() && token == null) {
|
|
|
// Don't authenticate via DT for DT ops.
|
|
|
token = authHandler.authenticate(request, response);
|
|
|
+ LOG.trace("Got token: {}.", token);
|
|
|
if (token == null) {
|
|
|
requestContinues = false;
|
|
|
doManagement = false;
|
|
@@ -353,6 +359,7 @@ public abstract class DelegationTokenAuthenticationHandler
|
|
|
AuthenticationToken token;
|
|
|
String delegationParam = getDelegationToken(request);
|
|
|
if (delegationParam != null) {
|
|
|
+ LOG.debug("Authenticating with dt param: {}", delegationParam);
|
|
|
try {
|
|
|
Token<AbstractDelegationTokenIdentifier> dt = new Token();
|
|
|
dt.decodeFromUrlString(delegationParam);
|
|
@@ -370,6 +377,7 @@ public abstract class DelegationTokenAuthenticationHandler
|
|
|
HttpServletResponse.SC_FORBIDDEN, new AuthenticationException(ex));
|
|
|
}
|
|
|
} else {
|
|
|
+ LOG.debug("Falling back to {} (req={})", authHandler.getClass(), request);
|
|
|
token = authHandler.authenticate(request, response);
|
|
|
}
|
|
|
return token;
|