/**
* Resolve the context of an entry. This is an effective test of
* JAAS setup, because it will relay detected problems up
* @param context context name
* @return the entry
* @throws RuntimeException if there is no context entry found
*/
public static AppConfigurationEntry[] validateContext(String context) {
if (context == null) {
throw new RuntimeException("Null context argument");
}
if (context.isEmpty()) {
throw new RuntimeException("Empty context argument");
}
javax.security.auth.login.Configuration configuration =
javax.security.auth.login.Configuration.getConfiguration();
AppConfigurationEntry[] entries =
configuration.getAppConfigurationEntry(context);
if (entries == null) {
throw new RuntimeException(
String.format("Entry \"%s\" not found; " +
"JAAS config = %s",
context,
describeProperty(Environment.JAAS_CONF_KEY) ));
}
return entries;
}
RegistrySecurity.java 文件源码
java
阅读 38
收藏 0
点赞 0
评论 0
项目:hadoop
作者:
评论列表
文章目录