Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ticket delegation #27

Closed
wants to merge 2 commits into from

Conversation

thmarti
Copy link

@thmarti thmarti commented Apr 16, 2015

Hi

For our project we've extended spring-security-kerberos to support ticket delegation. If you're interested to have this included in the plugin we'd write a few tests and maybe a sample project and some documentaiton (whatever your exact requirements are).

Regards,
Thomas Marti

I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.

@jvalkeal
Copy link
Contributor

Thanks, sounds interesting. We're about to release 1.0.0 so I'll take a deeper look after that.


public KerberosTicketValidation(String username, String servicePrincipal, byte[] responseToken, GSSContext gssContext) {
public KerberosTicketValidation(String username, String servicePrincipal, byte[] responseToken, GSSContext gssContext, GSSCredential delegationCredential) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than removing the constructor we should add an additional constructor to remain passive. Can you update the PR?

@rwinch
Copy link
Member

rwinch commented Apr 16, 2015

@thmarti Thanks for your PR! I commented in the code diff.

@jethrobakker
Copy link

I have created some sample code to delegate tickets to other HTTP services. More info on:

http://blog.concetto.io/post/2015/09/30/Microservices-and-Kerberos-authentication

@thmarti
Copy link
Author

thmarti commented May 3, 2016

Hi

Are you still interested in this? Is there more we need to do for you to accept this PR?

@thmarti
Copy link
Author

thmarti commented May 31, 2016

Hi @bjarkih

You need a couple of things:

  • Registry entry, if you use windows:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos\Parameters
Value Name: allowtgtsessionkey
Value Type: REG_DWORD
Value: 0x01
  • A krb5.conf file with forwardable = true
  • Configure the krb5.conf file in the JVM: System.setProperty("java.security.krb5.conf","/absolute/path/to/krb5.conf");
  • set refreshKrb5Config to true in SunJaasKerberosTicketValidator.java
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
            HashMap<String, String> options = new HashMap<String, String>();
            options.put("useKeyTab", "true");
            options.put("keyTab", this.keyTabLocation);
            options.put("principal", this.servicePrincipalName);
            options.put("storeKey", "true");
            options.put("doNotPrompt", "true");
            options.put("refreshKrb5Config", "true"); // <------- Here!

@bjarkih
Copy link

bjarkih commented Jun 2, 2016

Thanks @thmarti! I will give this a try and let you know how it goes.

@UlrichColby
Copy link

@thmarti I am trying to recreate your PR as well. I get the changes that you have made but I am trying to figure out how to get to the point that I am able to have a Subject object that I will ultimately allow me to call external services using a Subject.doAs method.

Thanks,
Ulrich

@dariusan
Copy link

dariusan commented Aug 3, 2016

@UlrichColby:
You can use the following code to get the subject after successfull ticket validation:

Object subject = sun.security.jgss.GSSUtil.getSubject( org.ietf.jgss.GSSManager.getInstance().createName("authenticatedUsernameFromPreviousStep", org.ietf.jgss.GSSName.NT_USER_NAME), context.getDelegCred())

@sterowney
Copy link
Contributor

Thanks @thmarti for your pull request i've been able to integrate with a kerberized back end services really easily via my kerberos protected rest service. I had to update to the latest code from master and resolve the conflicts which can be found here https://github.com/sterowney/spring-security-kerberos

Is there any plans for a 1.0.2.RELEASE with these great features? Happy to help

@ludochane
Copy link

In SunJaasKerberosTicketValidator.LoginConfig.getAppConfigurationEntry(), didn't you have to put isInitiator to true ?
If I leave it to false, no delegate credentials are sent by the end user.

@thmarti
Copy link
Author

thmarti commented Jul 5, 2017

@ludochane: To validate a ticket 'isInitiator' has to be false. What is your scenario? What exactly are you trying to do?

@ludochane
Copy link

Hi @thmarti,
I try to do credentials delegation. I made it work but in my case, calling context.getCredDelegState() always returns false. Except when I put isInitiator to true.

@dariusan
Copy link

dariusan commented Jul 5, 2017 via email

@ludochane
Copy link

Hi @dariusan,
I use Firefox and Chrome on Windows.
For Firefox, I have network.automatic-ntlm-auth.trusted-uris and network.negotiate-auth.trusted-uris which are well set for my host. Nonetheless, if I don't put isInitator to true, I can't retrieve delegate credentials. Anyway, I made it work, but it is weird though...

@koraktor
Copy link
Contributor

koraktor commented Jul 6, 2017

@ludochane You will have to set network.negotiate-auth.delegation-uris, too.

@ludochane
Copy link

@koraktor, oh yes network.negotiate-auth.delegation-uris was set too actually.

@GyllingSW
Copy link

What is the exact status on this topic?
I have a set of customer related project, that needs this functionality. I can manage to get it working for now, but it would be very good to know if there is an intention to actually merge this into the official release.
I can put in some hours if needed depending on your demand versus my capabilities

@rwinch
Copy link
Member

rwinch commented Mar 9, 2018

Sorry for the delayed response on this ticket. If the PR can be rebased off of master (I'm a bit pressed for time to do this myself), I'd be glad to review and merge.

@sterowney
Copy link
Contributor

It's updated here if needed? https://github.com/sterowney/spring-security-kerberos

@rwinch
Copy link
Member

rwinch commented Mar 16, 2018

@sterowney Thanks! Can you submit a PR please?

@dariusan
Copy link

dariusan commented Nov 7, 2018

@ludochane isInitiator=true is required on Windows when you have "constrained delegation" enabled instead of "unconstrained delegation" in AD. @sterowney Maybe the devs could make this configurable in their "multitier implementation". This (constrained delegation) is going to be the default soon on Windows 10 Clients with Windows Credential Guard enabled.

@rwinch
Copy link
Member

rwinch commented Nov 7, 2018

Closing in favor of #122

@rwinch rwinch closed this Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.