All Authorization Mechanism type should be of an allowed type
boolean oneFailed = false;
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if(!descriptor.getOutBoundDefined())
{
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA",
"Resource Adapter does not provide outbound communication"));
return result;
}
Set mechanisms =
descriptor.getOutboundResourceAdapter().getAuthMechanisms();
if (mechanisms.isEmpty()) {
// passed
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.AuthMechType.nonexist",
"No authentication mechanism defined for this resource adapater"));
return result;
}
Iterator mechIterator = mechanisms.iterator();
while (mechIterator.hasNext()) {
AuthMechanism am = (AuthMechanism) mechIterator.next();
String authMechType = am.getAuthMechType();
boolean allowedMech = false;
if (authMechType!=null) {
for (int i=0;i<allowedMechs.length;i++) {
if (authMechType.equals(allowedMechs[i])) {
allowedMech = true;
break;
}
}
}
if (!allowedMech || authMechType == null) {
// failed
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.AuthMechType.failed",
"Authentication mechanism type [ {0} ] is not allowed"));
}
}
if (!oneFailed) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.AuthMechType.passed",
"All defined authentication mechanism types are allowed"));
}
return result;