title: How to access kerberos SPNEGO authenticated resource using spring rest template
body: <p>I am running into issues while trying to access kerberos SPNEGO  authenticated resource using spring rest client. I am using <code>KerberosRestTemplate</code>.</p>
  
  <p>From the docs </p>
  
  <blockquote>
    <p>Leave <code>keyTabLocation</code> and <code>userPrincipal</code> empty if you want to use cached ticket.</p>
  </blockquote>
  
  <p>But while I try with invoking the parameterless constructor </p>
  
  <pre><code>this.kerberosRestTemplate = new KerberosRestTemplate();
  </code></pre>
  
  <p>And try to access to the protected resource it fails with the following error:</p>
  
  <pre><code>org.springframework.web.client.RestClientException: Error running rest call; nested exception is java.lang.IllegalArgumentException: Null name not allowed
      at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecute(KerberosRestTemplate.java:196) 
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:538) 
      at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:245) 
  Caused by: java.lang.IllegalArgumentException: Null name not allowed
          at sun.security.krb5.PrincipalName.&lt;init&gt;(PrincipalName.java:356) ~[?:1.7.0_67]
          at javax.security.auth.kerberos.KerberosPrincipal.&lt;init&gt;(KerberosPrincipal.java:123) ~[?:1.7.0_67]
          at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecute(KerberosRestTemplate.java:182)
  </code></pre>
  
  <p>What am I doing wrong here? </p>