Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 202F6200C3F for ; Wed, 22 Mar 2017 15:19:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1EB14160B83; Wed, 22 Mar 2017 14:19:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C3429160B86 for ; Wed, 22 Mar 2017 15:19:54 +0100 (CET) Received: (qmail 62704 invoked by uid 500); 22 Mar 2017 14:19:46 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 58022 invoked by uid 99); 22 Mar 2017 14:19:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2017 14:19:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4E967DFF77; Wed, 22 Mar 2017 14:19:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: oleewere@apache.org To: commits@ambari.apache.org Date: Wed, 22 Mar 2017 14:20:46 -0000 Message-Id: <43ec37e3c9e446c9b7792aee9c79d47d@git.apache.org> In-Reply-To: <0b35cdcf27ad450480bebb703b5305cd@git.apache.org> References: <0b35cdcf27ad450480bebb703b5305cd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [68/84] [abbrv] ambari git commit: AMBARI-20528. Rename Log Search Portal module to Log Search Server (oleewere) archived-at: Wed, 22 Mar 2017 14:19:57 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java deleted file mode 100644 index c6a5ba5..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.web.security; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchAuthenticationProviderTest { - private static final Authentication SUCCESSFUL_AUTHENTICATION = new TestingAuthenticationToken("principal", "credentials"); - private static final Authentication FAILED_AUTHENTICATION = new TestingAuthenticationToken("principal", "credentials"); - static { - SUCCESSFUL_AUTHENTICATION.setAuthenticated(true); - FAILED_AUTHENTICATION.setAuthenticated(false); - } - - private LogsearchAuthenticationProvider provider; - - private LogsearchLdapAuthenticationProvider mockLdapProvider; - private LogsearchFileAuthenticationProvider mockFileProvider; - private LogsearchExternalServerAuthenticationProvider mockExternalServerProvider; - private LogsearchSimpleAuthenticationProvider mockSimpleProvider; - - @Before - public void resetContext() throws Exception { - provider = new LogsearchAuthenticationProvider(); - - mockLdapProvider = strictMock(LogsearchLdapAuthenticationProvider.class); - mockFileProvider = strictMock(LogsearchFileAuthenticationProvider.class); - mockExternalServerProvider = strictMock(LogsearchExternalServerAuthenticationProvider.class); - mockSimpleProvider = strictMock(LogsearchSimpleAuthenticationProvider.class); - - Field ldapProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("ldapAuthenticationProvider"); - ldapProviderField.setAccessible(true); - ldapProviderField.set(provider, mockLdapProvider); - - Field fileProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("fileAuthenticationProvider"); - fileProviderField.setAccessible(true); - fileProviderField.set(provider, mockFileProvider); - - Field extarnalProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("externalServerAuthenticationProvider"); - extarnalProviderField.setAccessible(true); - extarnalProviderField.set(provider, mockExternalServerProvider); - - Field simpleProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("simpleAuthenticationProvider"); - simpleProviderField.setAccessible(true); - simpleProviderField.set(provider, mockSimpleProvider); - } - - @Test - public void testLdapAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testFileAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testExternalAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testSimpleAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testNoOneAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, FAILED_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testOneExceptionAndAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("") {}); - expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testOneExceptionNoOneAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {}); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown AuthenticationException", false); - } catch(AuthenticationException e) { - assertEquals(e.getMessage(), "msg1"); - } - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testTwoExceptionNoOneAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {}); - expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {}); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown AuthenticationException", false); - } catch(AuthenticationException e) { - assertEquals(e.getMessage(), "msg1"); - } - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java deleted file mode 100644 index d6247a1..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.web.security; - -import org.apache.ambari.logsearch.common.ExternalServerClient; -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.authority.SimpleGrantedAuthority; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchExternalServerAuthenticationProviderTest { - - private LogsearchExternalServerAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - private ExternalServerClient mockExternalServerClient; - - @Before - public void init() throws Exception { - provider = new LogsearchExternalServerAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - mockExternalServerClient = strictMock(ExternalServerClient.class); - - Field authPropsConfigField = LogsearchExternalServerAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - authPropsConfigField.setAccessible(true); - authPropsConfigField.set(provider, mockAuthPropsConfig); - - Field externalServerClientField = LogsearchExternalServerAuthenticationProvider.class.getDeclaredField("externalServerClient"); - externalServerClientField.setAccessible(true); - externalServerClientField.set(provider, mockExternalServerClient); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationEmptyUser() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("", "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullUser() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken(null, "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - - @Test - public void testAuthenticationEmptyPassword() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", ""); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullPassword() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", null); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationUnsuccessful() throws Exception { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - expect(mockAuthPropsConfig.getExternalAuthLoginUrl()).andReturn("http://server.com?userName=$USERNAME"); - expect(mockExternalServerClient.sendGETRequest("http://server.com?userName=principal", String.class, "principal", "credentials")) - .andReturn("{\"permission_name\": \"NOT.AMBARI.ADMINISTRATOR\" }"); - - replay(mockAuthPropsConfig, mockExternalServerClient); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("Bad credentials", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockExternalServerClient); - } - - @Test - public void testAuthenticationSuccessful() throws Exception { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - expect(mockAuthPropsConfig.getExternalAuthLoginUrl()).andReturn("http://server.com?userName=$USERNAME"); - expect(mockExternalServerClient.sendGETRequest("http://server.com?userName=principal", String.class, "principal", "credentials")) - .andReturn("{\"permission_name\": \"AMBARI.ADMINISTRATOR\" }"); - - replay(mockAuthPropsConfig, mockExternalServerClient); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - Authentication authenticationResult = provider.authenticate(authentication); - - assertEquals("principal", authenticationResult.getName()); - assertEquals("credentials", authenticationResult.getCredentials()); - assertEquals(1, authenticationResult.getAuthorities().size()); - assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next()); - - verify(mockAuthPropsConfig, mockExternalServerClient); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java deleted file mode 100644 index 407cc83..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.web.security; - -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.apache.ambari.logsearch.util.CommonUtil; -import org.apache.ambari.logsearch.web.model.User; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UserDetailsService; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.List; - -public class LogsearchFileAuthenticationProviderTest { - - private LogsearchFileAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - private UserDetailsService mockUserDetailsService; - - @Before - public void init() throws Exception { - provider = new LogsearchFileAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - mockUserDetailsService = strictMock(UserDetailsService.class); - - Field authPropsConfigField = LogsearchFileAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - authPropsConfigField.setAccessible(true); - authPropsConfigField.set(provider, mockAuthPropsConfig); - - Field userDetailsServiceField = LogsearchFileAuthenticationProvider.class.getDeclaredField("userDetailsService"); - userDetailsServiceField.setAccessible(true); - userDetailsServiceField.set(provider, mockUserDetailsService); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationEmptyUser() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("", "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullUser() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken(null, "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - - @Test - public void testAuthenticationEmptyPassword() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", ""); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullPassword() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", null); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationUnknownUser() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(null); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("User not found.", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockUserDetailsService); - } - - @Test - public void testAuthenticationNoPassword() { - List grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); - User user = new User("principal", null, grantedAuths); - - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockUserDetailsService); - } - - @Test - public void testAuthenticationWrongPassword() { - List grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); - User user = new User("principal", CommonUtil.encryptPassword("principal", "notCredentials"), grantedAuths); - - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("Wrong password.", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockUserDetailsService); - } - - @Test - public void testAuthenticationSuccessful() { - List grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); - User user = new User("principal", CommonUtil.encryptPassword("principal", "credentials"), grantedAuths); - - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - - Authentication authenticationResult = provider.authenticate(authentication); - assertEquals("principal", authenticationResult.getName()); - assertEquals(CommonUtil.encryptPassword("principal", "credentials"), authenticationResult.getCredentials()); - assertEquals(1, authenticationResult.getAuthorities().size()); - assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next()); - - verify(mockAuthPropsConfig, mockUserDetailsService); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java deleted file mode 100644 index c6af3e2..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.web.security; - -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; - -import static junit.framework.Assert.assertSame; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchLdapAuthenticationProviderTest { - - private LogsearchLdapAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - - @Before - public void init() throws Exception { - provider = new LogsearchLdapAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - - Field f = LogsearchLdapAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - f.setAccessible(true); - f.set(provider, mockAuthPropsConfig); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthLdapEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java deleted file mode 100644 index 7287012..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.web.security; - -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.authority.SimpleGrantedAuthority; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchSimpleAuthenticationProviderTest { - - private LogsearchSimpleAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - - @Before - public void init() throws Exception { - provider = new LogsearchSimpleAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - - Field f = LogsearchSimpleAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - f.setAccessible(true); - f.set(provider, mockAuthPropsConfig); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationEmptyUser() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("", "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullUser() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken(null, "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationSuccessful() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - - Authentication authenticationResult = provider.authenticate(authentication); - assertEquals("principal", authenticationResult.getName()); - assertEquals("credentials", authenticationResult.getCredentials()); - assertEquals(1, authenticationResult.getAuthorities().size()); - assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next()); - - verify(mockAuthPropsConfig); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json deleted file mode 100644 index 344dc3d..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "service": { - "accumulo": { - "label": "TestService", - "components": [ - { - "name": "test_component1" - }, - { - "name": "test_component2" - } - ], - "dependencies": [ - ] - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties deleted file mode 100755 index 2715d1f..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties +++ /dev/null @@ -1,33 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -logsearch.solr.audit.logs.config.name=test_audit_logs_config_name -logsearch.collection.audit.logs.numshards=123 -logsearch.collection.audit.logs.replication.factor=456 -logsearch.solr.collection.audit.logs=test_audit_logs_collection - -logsearch.solr.service.logs.config.name=test_service_logs_config_name -logsearch.collection.service.logs.numshards=789 -logsearch.collection.service.logs.replication.factor=987 -logsearch.solr.collection.service.logs=test_service_logs_collection -logsearch.service.logs.split.interval.mins=1 - -logsearch.solr.history.config.name=test_history_logs_config_name -logsearch.collection.history.replication.factor=234 -logsearch.solr.collection.history=test_history_logs_collection - -logsearch.auth.file.enable=true -logsearch.login.credentials.file=user_pass.json -logsearch.roles.allowed=AMBARI.ADMINISTRATOR http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json deleted file mode 100644 index 0a04afe..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "users": [{ - "name": "Test User Name", - "username": "testUserName", - "password": "testUserPassword", - "en_password": "" - }] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/.gitignore ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/.gitignore b/ambari-logsearch/ambari-logsearch-server/.gitignore new file mode 100644 index 0000000..07e0389 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/.gitignore @@ -0,0 +1,9 @@ +target +.settings +.classpath +.project +/bin/ +node_modules/ +logs/ +node/ + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/README.md ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/README.md b/ambari-logsearch/ambari-logsearch-server/README.md new file mode 100644 index 0000000..126f651 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/README.md @@ -0,0 +1,55 @@ + + +#Compilation +mvn clean compile package + +#Deploy +##Copy to remote +copy target/logsearch-portal.tar.gz to host machine +##Setup environment +```bash +mkdir /opt/logsearch +cd /opt/logsearch +tar xfz ~/logsearch-portal.tar.gz +``` +#Create Solr Collection +*Edit for log retention days (default is 7 days)* +```bash +vi solr_configsets/hadoop_logs/conf/solrconfig.xml +``` +``` + + _ttl_ + +7DAYS + +``` +```bash +./create_collections.sh $SOLR_HOME $NUM_SHARDS $NUM_OF_REPLICATIONS `pwd`/solr_configsets +``` +```bash +vi classes/logsearch.properties +``` +``` +solr.zkhosts=$ZK1:2181,$ZK2:2181,$ZK3:2181/solr +``` +*This script will stop logsearch if it is running and restart it* +```bash +./run.sh +``` http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/build.properties ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/build.properties b/ambari-logsearch/ambari-logsearch-server/build.properties new file mode 100644 index 0000000..1cd118a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/build.properties @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# log4j configuration used during build and unit tests + +TOMCAT_HOME=/Library/Tomcat/Home +app.work.dir=${builddir}/build/work +app.war.dir=${app.work.dir}/war +app.pkg.dir=${app.work.dir}/pkg + +app.dev.war.dir=${app.work.dir}/webapps/logsearch +app.war.name=logsearch.war + +app.target.dir=${builddir}/target/classes/webapps/app \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/build.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/build.xml b/ambari-logsearch/ambari-logsearch-server/build.xml new file mode 100644 index 0000000..aadacd7 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/build.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml new file mode 100755 index 0000000..52bda8d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/pom.xml @@ -0,0 +1,745 @@ + + + + + ambari-logsearch + org.apache.ambari + 2.0.0.0-SNAPSHOT + + 4.0.0 + org.apache.ambari + ambari-logsearch-server + jar + 2.0.0.0-SNAPSHOT + http://maven.apache.org + Ambari Logsearch Server + + 4.2.5.RELEASE + 4.0.4.RELEASE + 2.0.4.RELEASE + 2.23.2 + 9.2.11.v20150529 + 1.5.8 + 2.0.2.RELEASE + 0.6.0 + + + + + dev + + true + + + LogSearch + + + + maven-compiler-plugin + 3.0 + + + maven-dependency-plugin + 2.8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + 1.7 + 1.7 + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + java + + + + + org.apache.ambari.logsearch.LogSearch + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + unpack + prepare-package + + unpack + + + + + org.apache.ambari + ambari-logsearch-web + ${project.version} + ${project.build.outputDirectory}/ + webapps/** + + + + + + copy-dependencies + package + + copy-dependencies + + + * + ambari-logsearch-web + true + ${basedir}/target/libs + false + false + true + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + package + + + + + + + + + + run + + + + + + org.apache.rat + apache-rat-plugin + + + src/main/configsets/hadoop_logs/conf/managed-schema + **/*.log + **/*.json + + + + + test + + check + + + + + + + + + + + + production + + LogSearch + + + + maven-compiler-plugin + 3.0 + + + maven-dependency-plugin + 2.8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + 1.7 + 1.7 + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + java + + + + + org.apache.ambari.logsearch.LogSearch + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + copy-dependencies + package + + copy-dependencies + + + * + true + ${basedir}/target/libs + false + false + true + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + package + + + + + + + + + + run + + + + + + + org.apache.rat + apache-rat-plugin + + + **/* + + + + + test + + check + + + + + + + + + + skipMinify + + false + + + LogSearch + + + + maven-compiler-plugin + 3.0 + + + maven-dependency-plugin + 2.8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + 1.7 + 1.7 + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + java + + + + + org.apache.ambari.logsearch.LogSearch + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + copy-dependencies + package + + copy-dependencies + + + * + true + ${basedir}/target/libs + false + false + true + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + package + + + + + + + + + + run + + + + + + + + + + + junit + junit + test + + + org.easymock + easymock + 3.4 + test + + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-test + ${spring.version} + + + + org.springframework.security + spring-security-web + ${spring.security.version} + + + org.springframework.security + spring-security-core + ${spring.security.version} + + + org.springframework.security + spring-security-config + ${spring.security.version} + + + + org.springframework.ldap + spring-ldap-core + ${spring.ldap.version} + + + org.springframework.security + spring-security-ldap + ${spring.security.version} + + + org.glassfish.jersey.ext + jersey-spring3 + 2.23.2 + + + org.springframework + * + + + + + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey.version} + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-json-jettison + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + + + org.glassfish.jersey.core + jersey-common + ${jersey.version} + + + javax.servlet + javax.servlet-api + 3.1.0 + + + log4j + log4j + 1.2.17 + + + org.apache.solr + solr-solrj + ${solr.version} + + + org.apache.solr + solr-core + ${solr.version} + + + * + * + + + + + org.apache.lucene + lucene-core + ${solr.version} + + + org.apache.lucene + lucene-analyzers-common + ${solr.version} + + + + org.apache.hadoop + hadoop-common + 2.7.0 + + + javax.servlet + servlet-api + + + org.mortbay.jetty + jetty + + + org.mortbay.jetty + jetty-util + + + com.sun.jersey + jetty-util + + + com.sun.jersey + jersey-core + + + com.sun.jersey + jersey-json + + + com.sun.jersey + jersey-server + + + + + commons-io + commons-io + 2.4 + + + org.apache.ambari + ambari-logsearch-appender + ${project.version} + + + org.apache.ambari + ambari-metrics-common + ${project.version} + + + commons-cli + commons-cli + 1.3.1 + + + commons-codec + commons-codec + + + commons-lang + commons-lang + + + org.springframework.security.kerberos + spring-security-kerberos-core + 1.0.1.RELEASE + + + org.springframework.security.kerberos + spring-security-kerberos-web + 1.0.1.RELEASE + + + org.springframework.security.kerberos + spring-security-kerberos-client + 1.0.1.RELEASE + + + org.eclipse.jetty + jetty-security + ${jetty-version} + + + org.eclipse.jetty + jetty-server + ${jetty-version} + + + org.eclipse.jetty + jetty-servlet + ${jetty-version} + + + org.eclipse.jetty + jetty-servlets + ${jetty-version} + + + org.eclipse.jetty + jetty-util + ${jetty-version} + + + org.eclipse.jetty + jetty-webapp + ${jetty-version} + + + org.springframework + * + + + + + org.eclipse.jetty + jetty-annotations + ${jetty-version} + + + org.springframework + * + + + + + cglib + cglib + 3.2.4 + + + io.swagger + swagger-annotations + ${swagger.version} + + + io.swagger + swagger-core + ${swagger.version} + + + io.swagger + swagger-jersey2-jaxrs + ${swagger.version} + + + javax.ws.rs + jsr311-api + + + + + io.swagger + swagger-models + ${swagger.version} + + + org.webjars + swagger-ui + 2.1.0 + + + org.springframework.data + spring-data-solr + ${spring-data-solr.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.freemarker + freemarker + 2.3.20 + + + io.jsonwebtoken + jjwt + ${jjwt.version} + + + org.glassfish.jersey.ext + jersey-bean-validation + 2.25 + + + org.bouncycastle + bcprov-jdk15on + 1.55 + + + org.bouncycastle + bcpkix-jdk15on + 1.55 + + + org.apache.ambari + ambari-logsearch-web + ${project.version} + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/run.sh ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/run.sh b/ambari-logsearch/ambari-logsearch-server/run.sh new file mode 100755 index 0000000..ea89947 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/run.sh @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +echo " +██╗ ██████╗ ██████╗ ███████╗███████╗ █████╗ ██████╗ ██████╗██╗ ██╗ +██║ ██╔═══██╗██╔════╝ ██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝██║ ██║ +██║ ██║ ██║██║ ███╗ ███████╗█████╗ ███████║██████╔╝██║ ███████║ +██║ ██║ ██║██║ ██║ ╚════██║██╔══╝ ██╔══██║██╔══██╗██║ ██╔══██║ +███████╗╚██████╔╝╚██████╔╝ ███████║███████╗██║ ██║██║ ██║╚██████╗██║ ██║ +╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ +" +cd .. +mvn clean compile package -Pdev +cd ambari-logsearch-server +#mvn exec:java -Pdev +java -cp target/libs/*:target/classes/ org.apache.ambari.logsearch.LogSearch http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html new file mode 100755 index 0000000..fecab20 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html @@ -0,0 +1,24 @@ + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html new file mode 100755 index 0000000..3359a46 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html @@ -0,0 +1,25 @@ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html new file mode 100755 index 0000000..0886cee --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html @@ -0,0 +1,25 @@ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml new file mode 100644 index 0000000..25d5ceb --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7fafb5e5/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml new file mode 100644 index 0000000..458ee7e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml @@ -0,0 +1,28 @@ + + + + + UNKNOWN + TRACE + DEBUG + INFO + WARN + ERROR + FATAL + +