I'm using spnego ( http://spnego.sourceforge.net ) for kerberos authentication under JBoss.
I need to decrypt kerberos ticket to access the authorization-data which will containt PAC data. The PAC data is needed to decide which roles are to be granted to user.
How to access and decrypt kerberos ticket? I've searched net for examples, but without effort.
The Kerberos service ticket (SPNEGO token) proves the user's identity and permissions to the service (Liberty server). The client browser then responds to the Liberty server Authenticate: Negotiate challenge with the SPNEGO token that is obtained in the previous step in the request HTTP header.
SPNEGO (Simple Protocol GSSAPI Negotiation Mechanism) is a mechanism used in a client-server context to negotiate the choice of security technology. It is used when the parties have no clue about the authentication protocols their correspondent supports. The negotiable security mechanism includes Kerberos.
The mechanism token is usually a KerberosApRequest . There is a KerberosToken constructor which takes a KerberosApRequest . Simply pass in the mechanismToken byte array along with the key to decrypt the contents.
The SPNEGO protocol allows for a negotiation between the client (browser) and the server regarding the authentication mechanism to use. The client identity presented by the browser can be verified by WebSEAL using Kerberos authentication mechanisms.
These guys have a full PAC decoding implementation:
http://jaaslounge.sourceforge.net/
You can use the token parser like this:
HttpServletRequest request = (HttpServletRequest) req;
String header = request.getHeader("Authorization");
byte[] base64Token = header.substring(10).getBytes("UTF-8");
byte[] spnegoHeader = Base64.decode(base64Token);
SpnegoInitToken spnegoToken = new SpnegoInitToken(spnegoHeader);
You're going to need to jump though some hoops if you want to decrypt the underlying Kerberos ticket. Not sure if you need that.
Grant
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With