8327818: Implement Kerberos debug with sun.security.util.Debug

Reviewed-by: coffeys, ssahoo
This commit is contained in:
Weijun Wang 2024-03-18 15:36:28 +00:00
parent dec68d7e36
commit 569b05addf
62 changed files with 855 additions and 816 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -159,6 +159,33 @@ public class Debug {
}
}
/**
* Get a Debug object corresponding to the given option on the given
* property value.
* <p>
* Note: unlike other {@code getInstance} methods, this method does not
* use the {@code java.security.debug} system property.
* <p>
* Usually, this method is used by other individual area-specific debug
* settings. For example,
* {@snippet lang=java:
* Map<String, String> settings = loadLoginSettings();
* String property = settings.get("login");
* Debug debug = Debug.of("login", property);
* }
* @param option the debug option name
* @param property debug setting for this option
* @return a new Debug object if the property is true
*/
public static Debug of(String option, String property) {
if ("true".equalsIgnoreCase(property)) {
Debug d = new Debug();
d.prefix = option;
return d;
}
return null;
}
/**
* True if the system property "security.debug" contains the
* string "option".