The transport-guarantee element specifies that the communication between
client and server should be "SECURE", "NONE", or "CONFIDENTIAL".
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor.getSecurityConstraints().hasMoreElements()) {
boolean oneFailed = false;
boolean foundIt = false;
int na = 0;
int noSc = 0;
// get the errorpage's in this .war
for (Enumeration e = descriptor.getSecurityConstraints() ; e.hasMoreElements() ;) {
foundIt = false;
noSc++;
SecurityConstraintImpl securityConstraintImpl = (SecurityConstraintImpl) e.nextElement();
UserDataConstraintImpl userDataConstraint = (UserDataConstraintImpl) securityConstraintImpl.getUserDataConstraint();
if (userDataConstraint != null) {
String transportGuarantee = userDataConstraint.getTransportGuarantee();
if (transportGuarantee.length() > 0) {
if ((transportGuarantee.equals("NONE")) ||
(transportGuarantee.equals("INTEGRAL")) ||
(transportGuarantee.equals("CONFIDENTIAL"))) {
foundIt = true;
} else {
foundIt = false;
}
} else {
foundIt = false;
}
if (foundIt) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"transport-guarantee [ {0} ] specifies that the communication between client and server should be one of \"SECURE\", \"NONE\", or \"CONFIDENTIAL\" within web application [ {1} ]",
new Object[] {transportGuarantee, descriptor.getName()}));
} else {
if (!oneFailed) {
oneFailed = true;
}
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: transport-guarantee [ {0} ] does not specify that the communication between client and server is one of \"SECURE\", \"NONE\", or \"CONFIDENTIAL\" within web application [ {1} ]",
new Object[] {transportGuarantee, descriptor.getName()}));
}
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addNaDetails(smh.getLocalString
(getClass().getName() + ".notApplicable1",
"There are no transport-guarantee elements within the web application [ {0} ]",
new Object[] {descriptor.getName()}));
na++;
}
}
if (oneFailed) {
result.setStatus(Result.FAILED);
} else if (na == noSc) {
result.setStatus(Result.NOT_APPLICABLE);
} else {
result.setStatus(Result.PASSED);
}
} else {result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no transport-guarantee elements within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
return result;