ClassLoader savedCL = Thread.currentThread().getContextClassLoader();
try {
ServerPolicy serverPolicy = (ServerPolicy) ri.get_server_policy(ServerPolicyFactory.POLICY_TYPE);
if (serverPolicy == null) return;
TSSConfig tssPolicy = serverPolicy.getConfig();
if (tssPolicy == null) return;
if (serverPolicy.getClassloader() != null) Thread.currentThread().setContextClassLoader(serverPolicy.getClassloader());
if (log.isDebugEnabled()) log.debug("Found server policy");
ServiceContext serviceContext = ri.get_request_service_context(SecurityAttributeService.value);
if (serviceContext == null) return;
if (log.isDebugEnabled()) log.debug("Found service context");
Any any = Util.getCodec().decode_value(serviceContext.context_data, SASContextBodyHelper.type());
SASContextBody contextBody = SASContextBodyHelper.extract(any);
short msgType = contextBody.discriminator();
switch (msgType) {
case MTEstablishContext.value:
if (log.isDebugEnabled()) log.debug(" EstablishContext");
contextId = contextBody.establish_msg().client_context_id;
identity = tssPolicy.check(SSLSessionManager.getSSLSession(ri.request_id()), contextBody.establish_msg());
if (identity != null) {
ContextManager.registerSubject(identity);
} else {
identity = defaultSubject;