MinorCodes.SAS_TSS_FAILURE,
CompletionStatus.COMPLETED_NO);
}
// parse service context
SASContextBody contextBody = null;
long client_context_id = 0;
byte[] contextToken = null;
try
{
ServiceContext ctx =
ri.get_request_service_context(SASInitializer.SecurityAttributeService);
Any ctx_any =
codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
contextBody =
SASContextBodyHelper.extract(ctx_any);
}
catch (BAD_PARAM e)
{
if (logger.isDebugEnabled())
logger.debug("Could not parse service context for operation " +
ri.operation());
}
catch (Exception e)
{
if (logger.isWarnEnabled())
logger.warn("Could not parse service context for operation " +
ri.operation() + ": " + e);
}
if (contextBody == null &&
(sasValues.targetRequires & org.omg.CSIIOP.EstablishTrustInClient.value) != 0 &&
!ri.operation().equals("_non_existent") &&
!ri.operation().equals("_is_a"))
{
if (logger.isErrorEnabled())
logger.error("Did not parse service context for operation " +
ri.operation());
throw new org.omg.CORBA.NO_PERMISSION("No SAS service context found",
MinorCodes.SAS_TSS_FAILURE,
CompletionStatus.COMPLETED_NO);
}
if (contextBody == null)
{
if (logger.isDebugEnabled())
logger.debug("No context found, but not required");
return;
}
// process MessageInContext
if (contextBody.discriminator() == MTMessageInContext.value)
{
MessageInContext msg = null;
try
{
msg = contextBody.in_context_msg();
client_context_id = msg.client_context_id;
contextToken = getSASContext(connection, msg.client_context_id);
}
catch (Exception e)
{
if (logger.isErrorEnabled())
logger.error("Could not parse service MessageInContext " +
ri.operation() + ": " + e);
makeContextError(ri, client_context_id, 1, 1, contextToken);
throw new org.omg.CORBA.NO_PERMISSION("SAS Error parsing MessageInContext: " + e,
MinorCodes.SAS_TSS_FAILURE,
CompletionStatus.COMPLETED_NO);
}
if (contextToken == null)
{
if (logger.isErrorEnabled())
logger.error("Could not find context in MessageInContext " +
ri.operation() + ": " + msg.client_context_id);
makeContextError(ri, client_context_id, 2, 1, contextToken);
throw new org.omg.CORBA.NO_PERMISSION("SAS Error invalid context in MessageInContext",
MinorCodes.SAS_TSS_FAILURE,
CompletionStatus.COMPLETED_NO);
}
}
// process EstablishContext
if (contextBody.discriminator() == MTEstablishContext.value)
{
EstablishContext msg = null;
String principalName = null;
try
{
msg = contextBody.establish_msg();
client_context_id = msg.client_context_id;
contextToken = msg.client_authentication_token;
principalName = sasContext.getValidatedPrincipal();
}