YARN-2508. Cross Origin configuration parameters prefix are not honored (Mit Desai via jeagles)
(cherry picked from commit e6420fec0a
)
This commit is contained in:
parent
e392229676
commit
c47d72d8d2
|
@ -158,6 +158,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
YARN-2511. Allowed all origins by default when CrossOriginFilter is
|
YARN-2511. Allowed all origins by default when CrossOriginFilter is
|
||||||
enabled. (Jonathan Eagles via zjshen)
|
enabled. (Jonathan Eagles via zjshen)
|
||||||
|
|
||||||
|
YARN-2508. Cross Origin configuration parameters prefix are not honored
|
||||||
|
(Mit Desai via jeagles)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.timeline.webapp;
|
package org.apache.hadoop.yarn.server.timeline.webapp;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -37,6 +38,15 @@ public class CrossOriginFilterInitializer extends FilterInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, String> getFilterParameters(Configuration conf) {
|
static Map<String, String> getFilterParameters(Configuration conf) {
|
||||||
return conf.getValByRegex(PREFIX);
|
Map<String, String> filterParams =
|
||||||
|
new HashMap<String, String>();
|
||||||
|
for (Map.Entry<String, String> entry : conf.getValByRegex(PREFIX)
|
||||||
|
.entrySet()) {
|
||||||
|
String name = entry.getKey();
|
||||||
|
String value = entry.getValue();
|
||||||
|
name = name.substring(PREFIX.length());
|
||||||
|
filterParams.put(name, value);
|
||||||
|
}
|
||||||
|
return filterParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,8 @@ public class TestCrossOriginFilterInitializer {
|
||||||
CrossOriginFilterInitializer.getFilterParameters(conf);
|
CrossOriginFilterInitializer.getFilterParameters(conf);
|
||||||
|
|
||||||
// retrieve values
|
// retrieve values
|
||||||
String rootvalue =
|
String rootvalue = filterParameters.get("rootparam");
|
||||||
filterParameters.get(CrossOriginFilterInitializer.PREFIX + "rootparam");
|
String nestedvalue = filterParameters.get("nested.param");
|
||||||
String nestedvalue =
|
|
||||||
filterParameters.get(CrossOriginFilterInitializer.PREFIX
|
|
||||||
+ "nested.param");
|
|
||||||
String outofscopeparam = filterParameters.get("outofscopeparam");
|
String outofscopeparam = filterParameters.get("outofscopeparam");
|
||||||
|
|
||||||
// verify expected values are in place
|
// verify expected values are in place
|
||||||
|
|
Loading…
Reference in New Issue