This is a sample using a Spring RestTemplate to access Kerberos protected resource. You can use this together with Chapter 8, Security Server Spnego and Form Auth Sample.
Default application is configured as shown below.
app:
user-principal: [email protected]
keytab-location: /tmp/user2.keytab
access-url: http://neo.example.org:8080/hello
Using a user1 principal Section C.1, “Setup MIT Kerberos”, do a kerberos login
manually using credentials.
$ java -jar sec-client-rest-template-1.0.1.RELEASE.jar --app.user-principal --app.keytab-location
![]() | Note |
|---|---|
|
In above we simply set |
If operation is succesfull you should see below output with [email protected].
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>Spring Security Kerberos Example</title>
</head>
<body>
<h1>Hello [email protected]!</h1>
</body>
</html>
Or use a user2 with a keytab file.
$ java -jar sec-client-rest-template-1.0.1.RELEASE.jar
If operation is succesfull you should see below output with [email protected].
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>Spring Security Kerberos Example</title>
</head>
<body>
<h1>Hello [email protected]!</h1>
</body>
</html>