diff --git a/client/src/test/java/io/split/service/HTTPKerberosAuthIntercepterTest.java b/client/src/test/java/io/split/service/HTTPKerberosAuthIntercepterTest.java index 3868cdb8..353a765f 100644 --- a/client/src/test/java/io/split/service/HTTPKerberosAuthIntercepterTest.java +++ b/client/src/test/java/io/split/service/HTTPKerberosAuthIntercepterTest.java @@ -28,6 +28,8 @@ public class HTTPKerberosAuthIntercepterTest { @Test public void testBasicFlow() throws Exception { + System.setProperty("java.security.krb5.conf", "src/test/resources/krb5.conf"); + HTTPKerberosAuthInterceptor kerberosAuthInterceptor = mock(HTTPKerberosAuthInterceptor.class); LoginContext loginContext = PowerMockito.mock(LoginContext.class); when(kerberosAuthInterceptor.getLoginContext(any())).thenReturn((loginContext)); @@ -47,7 +49,7 @@ public void testBasicFlow() throws Exception { subject.getPrivateCredentials().add(new KerberosPrincipal("name")); doCallRealMethod().when(kerberosAuthInterceptor).getClientPrincipalName(); - assertThat(kerberosAuthInterceptor.getClientPrincipalName(), is(equalTo("bilal@EXAMPLE.COM"))) ; + assertThat(kerberosAuthInterceptor.getClientPrincipalName(), is(equalTo("bilal@ATHENA.MIT.EDU"))) ; verify(loginContext, times(2)).getSubject(); when(kerberosAuthInterceptor.buildAuthorizationHeader(any())).thenReturn("secured-token"); diff --git a/client/src/test/resources/krb5.conf b/client/src/test/resources/krb5.conf new file mode 100644 index 00000000..78d63ba8 --- /dev/null +++ b/client/src/test/resources/krb5.conf @@ -0,0 +1,37 @@ +# +# 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. +# + +[libdefaults] + kdc_realm = ATHENA.MIT.EDU + default_realm = ATHENA.MIT.EDU + kdc_tcp_port = 88 + kdc_udp_port = 88 + dns_lookup_realm = false + dns_lookup_kdc = false + udp_preference_limit = 1 + +[logging] + default = FILE:/var/logs/krb5kdc.log + +[realms] + ATHENA.MIT.EDU = { +# kdc = 10.12.4.76:88 +# kdc = tcp/10.12.4.76:88 +# kdc = tcp/192.168.1.19:88 + kdc = 192.168.1.19:88 + } \ No newline at end of file