}
public void send_request(org.omg.PortableInterceptor.ClientRequestInfo cri)
throws org.omg.PortableInterceptor.ForwardRequest
{
ClientRequestInfoImpl ri = (ClientRequestInfoImpl)cri;
if (ri.isLocalInterceptor())
{
return;
}
//if (ri.operation().equals("_is_a")) return;
//if (ri.operation().equals("_non_existent")) return;
org.omg.CORBA.ORB orb = ri.orb();
// see if target requires protected requests by looking into the IOR
CompoundSecMechList csmList = null;
try
{
TaggedComponent tc = ri.get_effective_component(TAG_CSI_SEC_MECH_LIST.value);
CDRInputStream is = new CDRInputStream(tc.component_data);
is.openEncapsulatedArray();
csmList = CompoundSecMechListHelper.read( is );
}
catch (BAD_PARAM e)
{
if (logger.isDebugEnabled())
logger.debug("Did not find tagged component TAG_CSI_SEC_MECH_LIST: "+
ri.operation());
}
catch (Exception e)
{
if (logger.isWarnEnabled())
logger.warn("Did not find tagged component TAG_CSI_SEC_MECH_LIST: "+e);
}
if(csmList != null &&
csmList.mechanism_list[0].as_context_mech.target_supports == 0 &&
csmList.mechanism_list[0].as_context_mech.target_requires == 0 &&
csmList.mechanism_list[0].sas_context_mech.target_supports == 0 &&
csmList.mechanism_list[0].sas_context_mech.target_requires == 0)
{
return;
}
// ask connection for client_context_id
ClientConnection connection = ri.getConnection();
long client_context_id = 0;
if (useStateful)
client_context_id = connection.cacheSASContext("css".getBytes());
if (client_context_id < 0)
{
if (logger.isInfoEnabled())
logger.info("New SAS Context: " + (-client_context_id));
}
// get ATLAS tokens
AuthorizationElement[] authorizationList = csmList != null
? getATLASTokens(orb, csmList)
: new AuthorizationElement[0];
// establish the security context
try
{
Any msg = null;
if (client_context_id <= 0)
{
IdentityToken identityToken = new IdentityToken();
identityToken.absent(true);
contextToken = sasContext.createClientContext(orb, codec, csmList);
msg = makeEstablishContext(orb,
-client_context_id,
authorizationList,
identityToken,
contextToken);
}
else
{
msg = makeMessageInContext(orb, client_context_id, false);
}
ri.add_request_service_context(new ServiceContext(SecurityAttributeService, codec.encode_value( msg ) ), true);
}
catch (Exception e)
{
logger.error ("Could not set security service context", e);