HADOOP-7576. Fix findbugs warnings and javac warnings in hadoop-auth.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1163456 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aba0e225fc
commit
4b661b3670
@ -48,17 +48,17 @@ public class KerberosAuthenticator implements Authenticator {
|
|||||||
/**
|
/**
|
||||||
* HTTP header used by the SPNEGO server endpoint during an authentication sequence.
|
* HTTP header used by the SPNEGO server endpoint during an authentication sequence.
|
||||||
*/
|
*/
|
||||||
public static String WWW_AUTHENTICATE = "WWW-Authenticate";
|
public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP header used by the SPNEGO client endpoint during an authentication sequence.
|
* HTTP header used by the SPNEGO client endpoint during an authentication sequence.
|
||||||
*/
|
*/
|
||||||
public static String AUTHORIZATION = "Authorization";
|
public static final String AUTHORIZATION = "Authorization";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP header prefix used by the SPNEGO client/server endpoints during an authentication sequence.
|
* HTTP header prefix used by the SPNEGO client/server endpoints during an authentication sequence.
|
||||||
*/
|
*/
|
||||||
public static String NEGOTIATE = "Negotiate";
|
public static final String NEGOTIATE = "Negotiate";
|
||||||
|
|
||||||
private static final String AUTH_HTTP_METHOD = "OPTIONS";
|
private static final String AUTH_HTTP_METHOD = "OPTIONS";
|
||||||
|
|
||||||
|
@ -103,6 +103,8 @@ public class AuthenticationFilter implements Filter {
|
|||||||
*/
|
*/
|
||||||
public static final String COOKIE_PATH = "cookie.path";
|
public static final String COOKIE_PATH = "cookie.path";
|
||||||
|
|
||||||
|
private static final Random RAN = new Random();
|
||||||
|
|
||||||
private Signer signer;
|
private Signer signer;
|
||||||
private AuthenticationHandler authHandler;
|
private AuthenticationHandler authHandler;
|
||||||
private boolean randomSecret;
|
private boolean randomSecret;
|
||||||
@ -139,7 +141,7 @@ public void init(FilterConfig filterConfig) throws ServletException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class klass = Thread.currentThread().getContextClassLoader().loadClass(authHandlerClassName);
|
Class<?> klass = Thread.currentThread().getContextClassLoader().loadClass(authHandlerClassName);
|
||||||
authHandler = (AuthenticationHandler) klass.newInstance();
|
authHandler = (AuthenticationHandler) klass.newInstance();
|
||||||
authHandler.init(config);
|
authHandler.init(config);
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
@ -151,7 +153,7 @@ public void init(FilterConfig filterConfig) throws ServletException {
|
|||||||
}
|
}
|
||||||
String signatureSecret = config.getProperty(configPrefix + SIGNATURE_SECRET);
|
String signatureSecret = config.getProperty(configPrefix + SIGNATURE_SECRET);
|
||||||
if (signatureSecret == null) {
|
if (signatureSecret == null) {
|
||||||
signatureSecret = Long.toString(new Random(System.currentTimeMillis()).nextLong());
|
signatureSecret = Long.toString(RAN.nextLong());
|
||||||
randomSecret = true;
|
randomSecret = true;
|
||||||
LOG.warn("'signature.secret' configuration not set, using a random value as secret");
|
LOG.warn("'signature.secret' configuration not set, using a random value as secret");
|
||||||
}
|
}
|
||||||
@ -237,7 +239,7 @@ public void destroy() {
|
|||||||
*/
|
*/
|
||||||
protected Properties getConfiguration(String configPrefix, FilterConfig filterConfig) throws ServletException {
|
protected Properties getConfiguration(String configPrefix, FilterConfig filterConfig) throws ServletException {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
Enumeration names = filterConfig.getInitParameterNames();
|
Enumeration<?> names = filterConfig.getInitParameterNames();
|
||||||
while (names.hasMoreElements()) {
|
while (names.hasMoreElements()) {
|
||||||
String name = (String) names.nextElement();
|
String name = (String) names.nextElement();
|
||||||
if (name.startsWith(configPrefix)) {
|
if (name.startsWith(configPrefix)) {
|
||||||
|
@ -57,6 +57,7 @@ protected Properties getConfiguration(String configPrefix, FilterConfig filterCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public static class TestServlet extends HttpServlet {
|
public static class TestServlet extends HttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -533,6 +533,9 @@ Release 0.23.0 - Unreleased
|
|||||||
HADOOP-7560. Change src layout to be heirarchical. (Alejandro Abdelnur
|
HADOOP-7560. Change src layout to be heirarchical. (Alejandro Abdelnur
|
||||||
via acmurthy)
|
via acmurthy)
|
||||||
|
|
||||||
|
HADOOP-7576. Fix findbugs warnings and javac warnings in hadoop-auth.
|
||||||
|
(szetszwo)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
Loading…
Reference in New Issue
Block a user