// Deny anonymous access to non-anonymous channels, and vice-versa
if (HTTPUtil.isAnonymousRequest(m_request, metadata))
{
if (http.getAuthMode() != HTTPChannel.AUTH_NONE)
{
throw new SecurityViolationException("err.rpc.anonymous");
}
}
else if (http.getAuthMode() == HTTPChannel.AUTH_NONE)
{
throw new SecurityViolationException("err.rpc.notAnonymous", new Object[]{sChannel});
}
boolean bRequestUsesCertificateAuth = HTTPUtil.isUsingClientCertificateAuthentication(m_request);
// Deny access to client certificate channels if no certificate present
if (http.getAuthMode() == HTTPChannel.AUTH_CERT)
{
if (!bRequestUsesCertificateAuth)
{
throw new SecurityViolationException("err.rpc.http.certificateRequired", new Object[]{sChannel});
}
X509Certificate[] certs = (X509Certificate[])m_request.getAttribute(HTTPUtil.CLIENT_CERTIFICATE_ATTRIBUTE_NAME);
if (certs == null)
{
throw new SecurityViolationException("err.integration.missingCertificate", new Object[]{sChannel});
}
// The certificate should now be validated against allowed certificates for this channel.
if (!HTTPUtil.isCertificateMatched(http.getTrustedCertificate(), certs))
{
throw new SecurityViolationException("err.integration.unauthorized", new Object[]{sChannel});
}
}
else if (bRequestUsesCertificateAuth)
{
// Deny access to non-certificate-auth channels through certificate authentication.
throw new SecurityViolationException("err.integration.unauthorized", new Object[]{sChannel});
}
if (http.getPrivilege() != null && !m_context.getPrivilegeSet().contains(http.getPrivilege()))
{
throw new SecurityViolationException("err.integration.unauthorized", new Object[]{sChannel});
}
m_lMaxRequestSize = http.getMaxRequestSize();
HTTPAdapter adapter = (HTTPAdapter)channel.getReceiver().getInstance(m_context);