AuthMethodpublic class AuthMethod extends com.sun.enterprise.tools.verifier.tests.web.WebTest implements WebCheckThe auth-method element is used to configure the authentication mechanism
for the web application. As a prerequisite to gaining access to any web
resources which are protected by an authorization constraint, a user must
have authenticated using the configured mechanism. Legal values for this
element are "BASIC", "DIGEST", "FORM", or "CLIENT-CERT". |
Methods Summary |
---|
public Result | check(WebBundleDescriptor descriptor)The auth-method element is used to configure the authentication mechanism
for the web application. As a prerequisite to gaining access to any web
resources which are protected by an authorization constraint, a user must
have authenticated using the configured mechanism. Legal values for this
element are "BASIC", "DIGEST", "FORM", or "CLIENT-CERT".
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor.getLoginConfiguration() != null) {
boolean foundIt = false;
boolean na = false;
String authMethod = descriptor.getLoginConfiguration().getAuthenticationMethod();
if (authMethod.length() > 0) {
// use hard-coded strings until DOL gets updated
if ((authMethod.equals("BASIC")) ||
(authMethod.equals("FORM")) ||
(authMethod.equals("CLIENT-CERT")) ||
(authMethod.equals("DIGEST"))) {
foundIt = true;
} else {
foundIt = false;
}
} else {
na = true;
}
if (foundIt) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"The auth-method [ {0} ] is legal value within web application [ {1} ]",
new Object[] {authMethod, descriptor.getName()}));
} else if (na) {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no auth-method elements within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
} else {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: The auth-method [ {0} ] is not legal value within web application [ {1} ]. It must be either [ {2} ], [ {3} ], [ {4} ] or [ {5} ].",
new Object[] {authMethod, descriptor.getName(),"BASIC","FORM","CLIENT-CERT","DIGEST"}));
}
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no auth-method elements within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
return result;
|
|