use of javax.security.auth.message.MessagePolicy in project Payara by payara.
the class GFServerConfigProvider method getEntry.
Entry getEntry(String intercept, String id, MessagePolicy requestPolicy, MessagePolicy responsePolicy, String type) {
// get the parsed module config and DD information
Map<String, InterceptEntry> configMap;
try {
rwLock.readLock().lock();
configMap = parser.getConfigMap();
} finally {
rwLock.readLock().unlock();
}
if (configMap == null) {
return null;
}
// get the module config info for this intercept
InterceptEntry intEntry = configMap.get(intercept);
if (intEntry == null || intEntry.idMap == null) {
if (logger.isLoggable(FINE)) {
logger.fine("module config has no IDs configured for [" + intercept + "]");
}
return null;
}
// look up the DD's provider ID in the module config
IDEntry idEntry = null;
if (id == null || (idEntry = (IDEntry) intEntry.idMap.get(id)) == null) {
if (logger.isLoggable(FINE)) {
logger.fine("DD did not specify ID, " + "or DD-specified ID for [" + intercept + "] not found in config -- " + "attempting to look for default ID");
}
String defaultID;
if (CLIENT.equals(type)) {
defaultID = intEntry.defaultClientID;
} else {
defaultID = intEntry.defaultServerID;
}
idEntry = (IDEntry) intEntry.idMap.get(defaultID);
if (idEntry == null) {
if (logger.isLoggable(FINE)) {
logger.fine("no default config ID for [" + intercept + "]");
}
return null;
}
}
// check provider-type
if (idEntry.type.indexOf(type) < 0) {
if (logger.isLoggable(FINE)) {
logger.fine("request type [" + type + "] does not match config type [" + idEntry.type + "]");
}
return null;
}
// check whether a policy is set
// default;
MessagePolicy reqP = requestPolicy != null || responsePolicy != null ? requestPolicy : idEntry.requestPolicy;
// default;
MessagePolicy respP = requestPolicy != null || responsePolicy != null ? responsePolicy : idEntry.responsePolicy;
// optimization: if policy was not set, return null
if (reqP == null && respP == null) {
if (logger.isLoggable(FINE)) {
logger.fine("no policy applies");
}
return null;
}
// return the configured modules with the correct policies
Entry entry = new Entry(idEntry.moduleClassName, reqP, respP, idEntry.options);
if (logger.isLoggable(FINE)) {
logger.fine("getEntry for: " + intercept + " -- " + id + "\n module class: " + entry.moduleClassName + "\n options: " + entry.options + "\n request policy: " + entry.requestPolicy + "\n response policy: " + entry.responsePolicy);
}
return entry;
}
Aggregations