343 }
344 return null;
345 }
346
347 /*
348 * Returns path name of the credentials cache file.
349 * The path name is searched in the following order:
350 *
351 * 1. KRB5CCNAME (bare file name without FILE:)
352 * 2. /tmp/krb5cc_<uid> on unix systems
353 * 3. <user.home>/krb5cc_<user.name>
354 * 4. <user.home>/krb5cc (if can't get <user.name>)
355 */
356
357 public static String getDefaultCacheName() {
358
359 String stdCacheNameComponent = "krb5cc";
360 String name;
361
362 // The env var can start with TYPE:, we only support FILE: here.
363 // http://docs.oracle.com/cd/E19082-01/819-2252/6n4i8rtr3/index.html
364 name = java.security.AccessController.doPrivileged(
365 new java.security.PrivilegedAction<String>() {
366 @Override
367 public String run() {
368 String cache = System.getenv("KRB5CCNAME");
369 if (cache != null &&
370 (cache.length() >= 5) &&
371 cache.regionMatches(true, 0, "FILE:", 0, 5)) {
372 cache = cache.substring(5);
373 }
374 return cache;
375 }
376 });
377 if (name != null) {
378 if (DEBUG) {
379 System.out.println(">>>KinitOptions cache name is " + name);
380 }
381 return name;
382 }
383
|
343 }
344 return null;
345 }
346
347 /*
348 * Returns path name of the credentials cache file.
349 * The path name is searched in the following order:
350 *
351 * 1. KRB5CCNAME (bare file name without FILE:)
352 * 2. /tmp/krb5cc_<uid> on unix systems
353 * 3. <user.home>/krb5cc_<user.name>
354 * 4. <user.home>/krb5cc (if can't get <user.name>)
355 */
356
357 public static String getDefaultCacheName() {
358
359 String stdCacheNameComponent = "krb5cc";
360 String name;
361
362 // The env var can start with TYPE:, we only support FILE: here.
363 // https://docs.oracle.com/cd/E19082-01/819-2252/6n4i8rtr3/index.html
364 name = java.security.AccessController.doPrivileged(
365 new java.security.PrivilegedAction<String>() {
366 @Override
367 public String run() {
368 String cache = System.getenv("KRB5CCNAME");
369 if (cache != null &&
370 (cache.length() >= 5) &&
371 cache.regionMatches(true, 0, "FILE:", 0, 5)) {
372 cache = cache.substring(5);
373 }
374 return cache;
375 }
376 });
377 if (name != null) {
378 if (DEBUG) {
379 System.out.println(">>>KinitOptions cache name is " + name);
380 }
381 return name;
382 }
383
|