kiranm516 / kerberos-auth-example

The demonstration of authentication against kerberos-enabled proxy with Java's Krb5LoginModule.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kerberos proxy authentication example

This is the demonstration of authentication against kerberos-enabled proxy with Java's Krb5LoginModule.

Prerequisites

Kerberos

You need to have running kerberos authentication server. If you don't want to install your own Kerberos and just need something quick to try then you can use demo freeIPA server.

Proxy server

You need to have a proxy with kerberos authentication in place.

One such proxy is Squid - see Proxy Authentication for more details

Configuration

Update username and password in KerberosCallBackHandler and proxy host and/port in KerberosAuthExample.

If appropriate, you can also update configuration in login.conf file.

Running

Just run KerberosAuthExample main method. If everything works, you should see content of example.com in console.

proxy-vole

There's a great proxy-vole library which can be used for proxy configuration detection.

If you want, you can use it to detect system's proxy settings and use system-wide proxy instead of hard-coded one in KerberosAuthExample - just use appropriate proxy selector to retrieve proper proxy settings

// for java HTTP stuff
ProxySelector.setDefault(proxySearch.getProxySelector());

// for HTTP client, you have to set proper proxy router planner
...

About

The demonstration of authentication against kerberos-enabled proxy with Java's Krb5LoginModule.


Languages

Language:Java 100.0%