Skip to content

Use Windows SSPI API to generate kerberos ticket for JDBC SSO #441

New issue

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

By clicking “No 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? No Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ibre5041
Copy link
Member

This sample shows how to use SSO uging Kerberos in Windows.
Since WIN2019 allowtgtsessionkey registry key is not available
and the only option how to acces Kerberos TGT is via Java's SSPI bridge.

This example activates sspi_bridge.dll library in Java JDK and uses Windowd SSPI API to generate Kerberos ticket.

Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

  • PR author: ibre5041

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Apr 18, 2025
@ibre5041 ibre5041 marked this pull request as draft April 18, 2025 17:21
@ibre5041 ibre5041 marked this pull request as ready for review April 18, 2025 17:22
@ibre5041 ibre5041 changed the title Use Windows SSPI API to generate Kerberos ticket for JDBC SSO Use Windows SSPI API to generate kerberos ticket for JDBC SSO Apr 18, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Apr 18, 2025

// Activate SSPI bridge, your Kerberos token will be created using Windows SSPI API
System.setProperty("sun.security.jgss.native", "true");
System.setProperty("sun.security.jgss.lib", "sspi_bridge.dll");
Copy link
Contributor

Choose a reason for hiding this comment

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

According to JDK-8214079 there is no need to sun.security.jgss.lib as long as sun.security.jgss.native is set to true. Can you please doublecheck?

import oracle.net.ano.AnoServices;

public class GSSAuthSSPIConnectSample {
// This should return your AD LOGIN
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for consistency with the other code samples: could you please use 2 space characters for indentation?

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants