@Override
public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject)
throws AuthException
{
Request request = (Request) messageInfo.getRequestMessage();
Response response = (Response) messageInfo.getResponseMessage();
Principal principal;
context = request.getContext();
X509Certificate certs[] = (X509Certificate[])
request.getAttribute(CERTIFICATES_ATTR);
if ((certs == null) || (certs.length < 1)) {
request.getCoyoteRequest().action
(ActionCode.ACTION_REQ_SSL_CERTIFICATE, null);
certs = (X509Certificate[])
request.getAttribute(CERTIFICATES_ATTR);
}
if ((certs == null) || (certs.length < 1)) {
log.debug(" No certificates included with this request");
try
{
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
sm.getString("authenticator.certificates"));
}
catch (IOException e)
{
log.error(e.getLocalizedMessage(),e);
}
return (AuthStatus.FAILURE);
}
// Authenticate the specified certificate chain
principal = context.getRealm().authenticate(certs);
if (principal == null) {
log.debug(" Realm.authenticate() returned false");
try
{
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
sm.getString("authenticator.unauthorized"));
}
catch (IOException e)
{
log.error(e.getLocalizedMessage(),e);