diff --git a/addons/falcon-bridge-shim/pom.xml b/addons/falcon-bridge-shim/pom.xml index 02da049db..c554e890a 100755 --- a/addons/falcon-bridge-shim/pom.xml +++ b/addons/falcon-bridge-shim/pom.xml @@ -55,6 +55,22 @@ org.mortbay.jetty servlet-api + + org.springframework + spring-beans + + + org.springframework + spring-jms + + + org.springframework + spring-tx + + + org.springframework + spring-context + diff --git a/addons/falcon-bridge/pom.xml b/addons/falcon-bridge/pom.xml index e0d2f3be7..de22fa5a0 100644 --- a/addons/falcon-bridge/pom.xml +++ b/addons/falcon-bridge/pom.xml @@ -70,6 +70,18 @@ org.mortbay.jetty servlet-api + + org.springframework + spring-beans + + + org.springframework + spring-jms + + + org.springframework + spring-tx + diff --git a/authorization/pom.xml b/authorization/pom.xml index 8e5a85db4..7a1108487 100644 --- a/authorization/pom.xml +++ b/authorization/pom.xml @@ -54,6 +54,7 @@ org.springframework.security spring-security-core + ${spring.security.version} diff --git a/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java b/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java index ece6e370a..7259036be 100644 --- a/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java +++ b/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java @@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; -import org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor; +import org.springframework.core.type.AnnotationMetadata; public class OnAtlasPropertyCondition implements Condition { private final Logger LOG = LoggerFactory.getLogger(OnAtlasPropertyCondition.class); @@ -37,16 +37,18 @@ public class OnAtlasPropertyCondition implements Condition { boolean matches = false; String propertyName = (String) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("property"); boolean isDefault = (Boolean) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("isDefault"); - String className = ((AnnotationMetadataReadingVisitor) metadata).getClassName(); + if (metadata instanceof AnnotatedTypeMetadata) { + String className = ((AnnotationMetadata) metadata).getClassName(); - try { - Configuration configuration = ApplicationProperties.get(); - String configuredProperty = configuration.getString(propertyName); - if (StringUtils.isNotEmpty(configuredProperty)) { - matches = configuredProperty.equals(className); - } else if (isDefault) matches = true; - } catch (AtlasException e) { - LOG.error("Unable to load atlas properties. Dependent bean configuration may fail"); + try { + Configuration configuration = ApplicationProperties.get(); + String configuredProperty = configuration.getString(propertyName); + if (StringUtils.isNotEmpty(configuredProperty)) { + matches = configuredProperty.equals(className); + } else if (isDefault) matches = true; + } catch (AtlasException e) { + LOG.error("Unable to load atlas properties. Dependent bean configuration may fail"); + } } return matches; } diff --git a/pom.xml b/pom.xml index 263b3e186..a3f30e890 100644 --- a/pom.xml +++ b/pom.xml @@ -760,8 +760,8 @@ 8.6.3 8.6.3 1.3.1 - 4.2.17.RELEASE - 4.3.29.RELEASE + 5.5.1 + 5.3.8 1.4.6.2.3.99.0-195 2.1.0 2C @@ -1073,6 +1073,22 @@ import + + org.springframework + spring-framework-bom + ${spring.version} + pom + import + + + + org.springframework.security + spring-security-bom + ${spring.security.version} + pom + import + + commons-configuration @@ -1347,61 +1363,6 @@ ${javax.servlet.version} - - - org.springframework - spring-core - ${spring.version} - - - - org.springframework - spring-web - ${spring.version} - - - - org.springframework - spring-webmvc - ${spring.version} - - - - org.springframework.security - spring-security-core - ${spring.security.version} - - - - org.springframework.security - spring-security-web - ${spring.security.version} - - - - org.springframework.security - spring-security-config - ${spring.security.version} - - - - org.springframework.security - spring-security-ldap - ${spring.security.version} - - - - org.springframework - spring-aop - ${spring.version} - - - - org.springframework - spring-test - ${spring.version} - - org.apache.atlas diff --git a/repository/pom.xml b/repository/pom.xml index bf34efee2..1607d9aed 100755 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -180,11 +180,13 @@ org.springframework spring-aop + ${spring.version} org.springframework spring-test + ${spring.version} diff --git a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java index 343d00d72..c8b7ff8d9 100644 --- a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java +++ b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java @@ -367,13 +367,13 @@ public class GraphTransactionInterceptor implements MethodInterceptor { } }; - public void lockObject(final List guids) { + public void lockObject(final List guids) { if (LOG.isDebugEnabled()) { LOG.debug("==> lockObject(): guids: {}", guids); } - Collections.sort(guids); - for (String g : guids) { + Collections.sort((List) guids); + for (String g : (List) guids) { lockObject(g); } } diff --git a/test-tools/pom.xml b/test-tools/pom.xml index c861ea67f..991fa14c9 100644 --- a/test-tools/pom.xml +++ b/test-tools/pom.xml @@ -56,6 +56,10 @@ org.apache.logging.log4j log4j-slf4j-impl + + org.apache.logging.log4j + log4j-1.2-api + diff --git a/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java b/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java index e16796ff6..cc2397633 100644 --- a/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java +++ b/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java @@ -24,11 +24,13 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Properties; import java.util.List; +import java.security.NoSuchAlgorithmException; import javax.annotation.PostConstruct; import org.apache.atlas.web.security.AtlasAuthenticationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.security.authentication.encoding.ShaPasswordEncoder; +import org.springframework.security.crypto.codec.Hex; +import org.springframework.security.crypto.codec.Utf8; import org.springframework.stereotype.Repository; import org.apache.atlas.ApplicationProperties; import org.apache.atlas.AtlasException; @@ -48,7 +50,6 @@ public class UserDao { private static final Logger LOG = LoggerFactory.getLogger(UserDao.class); private static final String DEFAULT_USER_CREDENTIALS_PROPERTIES = "users-credentials.properties"; - private static final ShaPasswordEncoder sha256Encoder = new ShaPasswordEncoder(256); private static boolean v1ValidationEnabled = true; private static boolean v2ValidationEnabled = true; @@ -180,7 +181,7 @@ public class UserDao { boolean ret = false; try { - String hash = sha256Encoder.encodePassword(password, salt); + String hash = encodePassword(password, salt); ret = hash != null && hash.equals(encryptedPwd); } catch (Throwable excp) { @@ -233,4 +234,33 @@ public class UserDao { throw new AtlasAuthenticationException("Exception while encoding password.", ex); } } -} + + public static String encodePassword(String rawPass, Object salt) { + String saltedPass = mergePasswordAndSalt(rawPass, salt, false); + MessageDigest messageDigest = getMessageDigest(); + byte[] digest = messageDigest.digest(Utf8.encode(saltedPass)); + + return new String(Hex.encode(digest)); + } + + protected static final MessageDigest getMessageDigest() throws IllegalArgumentException { + try { + return MessageDigest.getInstance("SHA-256"); + } catch (NoSuchAlgorithmException var2) { + throw new IllegalArgumentException("No such algorithm [SHA-256 ]"); + } + } + + protected static String mergePasswordAndSalt(String password, Object salt, boolean strict) { + if (!StringUtils.hasText(password)) { + password = ""; + } + + if (strict && salt != null && (salt.toString().lastIndexOf("{") != -1 || salt.toString().lastIndexOf("}") != -1)) { + throw new IllegalArgumentException("Cannot use { or } in salt.toString()"); + } else { + return StringUtils.hasText(salt.toString()) ? password + "{" + salt.toString() + "}" : password; + } + } + +} \ No newline at end of file diff --git a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java index 71eca2e50..bc7e71b96 100755 --- a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java +++ b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java @@ -214,12 +214,8 @@ public final class Servlets { } } - public static String decodeQueryString(String query){ - try { - return UriUtils.decode(query,"UTF-8"); + public static String decodeQueryString(String query) { + return UriUtils.decode(query,"UTF-8"); - } catch (UnsupportedEncodingException e){ - return query; - } } } diff --git a/webapp/src/main/webapp/WEB-INF/web.xml b/webapp/src/main/webapp/WEB-INF/web.xml index 7fb56efde..7bc931920 100755 --- a/webapp/src/main/webapp/WEB-INF/web.xml +++ b/webapp/src/main/webapp/WEB-INF/web.xml @@ -97,10 +97,6 @@ /api/atlas/admin/status - - org.springframework.web.util.Log4jConfigListener - - org.springframework.web.context.request.RequestContextListener diff --git a/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java b/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java index 519be804e..14227999e 100644 --- a/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java @@ -65,4 +65,9 @@ public class UserDaoTest { assertTrue(hadException); } + @Test + public void testUserDaowithencodePassword() { + assertTrue(UserDao.checkEncrypted("admin", "a4a88c0872bf652bb9ed803ece5fd6e82354838a9bf59ab4babb1dab322154e1", "admin")); + } + } \ No newline at end of file diff --git a/webapp/src/test/webapp/WEB-INF/web.xml b/webapp/src/test/webapp/WEB-INF/web.xml index 2388fbfbb..fd1d492fc 100755 --- a/webapp/src/test/webapp/WEB-INF/web.xml +++ b/webapp/src/test/webapp/WEB-INF/web.xml @@ -67,10 +67,6 @@ /* - - org.springframework.web.util.Log4jConfigListener - - org.springframework.web.context.request.RequestContextListener