Repository: ambari
Updated Branches:
  refs/heads/trunk 7e08470cf -> 3939afaf6


AMBARI-18406. Create authentication filter to perform Kerberos authentication 
for Ambari [amended] (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3939afaf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3939afaf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3939afaf

Branch: refs/heads/trunk
Commit: 3939afaf6e30d95186e5cce92712b4485c2013bf
Parents: 7e08470
Author: Robert Levas <rle...@hortonworks.com>
Authored: Wed Sep 21 13:07:44 2016 -0400
Committer: Robert Levas <rle...@hortonworks.com>
Committed: Wed Sep 21 13:07:44 2016 -0400

----------------------------------------------------------------------
 .../AmbariAuthToLocalUserDetailsServiceTest.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3939afaf/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariAuthToLocalUserDetailsServiceTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariAuthToLocalUserDetailsServiceTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariAuthToLocalUserDetailsServiceTest.java
index 4b93f2f..41664fd 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariAuthToLocalUserDetailsServiceTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariAuthToLocalUserDetailsServiceTest.java
@@ -25,6 +25,7 @@ import org.apache.ambari.server.security.authorization.User;
 import org.apache.ambari.server.security.authorization.UserType;
 import org.apache.ambari.server.security.authorization.Users;
 import org.easymock.EasyMockSupport;
+import org.junit.Before;
 import org.junit.Test;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
@@ -36,6 +37,14 @@ import java.util.Collections;
 import static org.easymock.EasyMock.expect;
 
 public class AmbariAuthToLocalUserDetailsServiceTest extends EasyMockSupport {
+  @Before
+  public void setup() {
+    // These system properties need to be set to properly configure the 
KerberosName object when
+    // a krb5.conf file is not available
+    System.setProperty("java.security.krb5.realm", "EXAMPLE.COM");
+    System.setProperty("java.security.krb5.kdc", "localhost");
+  }
+
   @Test
   public void loadUserByUsernameSuccess() throws Exception {
     AmbariKerberosAuthenticationProperties properties = new 
AmbariKerberosAuthenticationProperties();
@@ -55,11 +64,6 @@ public class AmbariAuthToLocalUserDetailsServiceTest extends 
EasyMockSupport {
 
     replayAll();
 
-    // These system properties need to be set to properly configure the 
KerberosName object when
-    // a krb5.conf file is not available
-    System.setProperty("java.security.krb5.realm", "EXAMPLE.COM");
-    System.setProperty("java.security.krb5.kdc", "localhost");
-
     UserDetailsService userdetailsService = new 
AmbariAuthToLocalUserDetailsService(configuration, users);
 
     UserDetails userDetails = 
userdetailsService.loadUserByUsername("us...@example.com");

Reply via email to