@@ -81,7 +81,7 @@ public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
8181
8282 if (sun .security .krb5 .internal .Krb5 .DEBUG ) {
8383 sun .security .krb5 .Config config = sun .security .krb5 .Config .getInstance ();
84- System .out .println ("DEBUG: Config isForwardable = " + config . getBooleanValue ("libdefaults" , "forwardable" ));
84+ System .out .println ("DEBUG: Config isForwardable = " + getBooleanValue (config , "libdefaults" , "forwardable" ));
8585 sun .security .krb5 .internal .KDCOptions opts = new sun .security .krb5 .internal .KDCOptions ();
8686 System .out .println ("DEBUG: KDCOptions isForwardable = " + opts .get (sun .security .krb5 .internal .Krb5 .TKT_OPTS_FORWARDABLE ));
8787 System .out .println ("DEBUG: Requesting TGT for " + principal );
@@ -131,7 +131,7 @@ public static SgtTicket obtainImpersonationTicket(String clientPrincipal, Kerber
131131
132132 if (sun .security .krb5 .internal .Krb5 .DEBUG ) {
133133 sun .security .krb5 .Config config = sun .security .krb5 .Config .getInstance ();
134- System .out .println ("DEBUG: Config isForwardable = " + config . getBooleanValue ("libdefaults" , "forwardable" ));
134+ System .out .println ("DEBUG: Config isForwardable = " + getBooleanValue (config , "libdefaults" , "forwardable" ));
135135 sun .security .krb5 .internal .KDCOptions opts = new sun .security .krb5 .internal .KDCOptions ();
136136 System .out .println ("DEBUG: KDCOptions isForwardable = " + opts .get (sun .security .krb5 .internal .Krb5 .TKT_OPTS_FORWARDABLE ));
137137 System .out .println ("DEBUG: TGT (KerberosTicket) isForwardable = " + serviceTGT .isForwardable ());
@@ -173,12 +173,12 @@ public static SgtTicket obtainBackendServiceTicket(String backendServiceName, Ti
173173 }
174174
175175 // Make a S4U2Proxy request to get a backend ST
176- sun .security .krb5 .KrbTgsReq req = new sun .security .krb5 .KrbTgsReq (
177- serviceTGTCreds ,
176+ sun .security .krb5 .Credentials creds = sun .security .krb5 .internal . CredentialsUtil . acquireS4U2proxyCreds (
177+ backendServiceName ,
178178 sunTicket ,
179- new sun . security . krb5 . PrincipalName ( backendServiceName ));
180- sun . security . krb5 . Credentials creds = req . sendAndGetCreds ( );
181-
179+ serviceTGTCreds . getClient (),
180+ serviceTGTCreds );
181+
182182 SgtTicket sgtTicket = convertToTicket (creds , backendServiceName , proxyServiceTicket .getRealm ());
183183 return sgtTicket ;
184184 }
@@ -236,4 +236,19 @@ public static void persistTicket(SgtTicket ticket, String destinationCCache) thr
236236 krbClient .storeTicket (ticket , cCacheFile );
237237 }
238238 }
239+
240+ /**
241+ * Used to provide compatibility between differnt JDKs.
242+ * The Config.getBooleanValue is removed in newer versions in favor of getBooleanObject.
243+ * However, getBooleanObject is private in older versions.
244+ */
245+ private static boolean getBooleanValue (sun .security .krb5 .Config config , String ...keys ) {
246+ String val = config .get (keys );
247+ if (val != null && val .equalsIgnoreCase ("true" )) {
248+ return true ;
249+ } else {
250+ return false ;
251+ }
252+
253+ }
239254}
0 commit comments