Program: 34879
Project: 34879
Buggy source:
@FFDCIgnore({javax.security.auth.message.AuthException.class,com.ibm.websphere.security.auth.WSLoginFailedException.class}) private AuthenticationResult authenticate(Subject clientSubject,String authType,JaspiRequest jaspiRequest,AuthConfigProvider provider) throws AuthenticationException {
  if (tc.isEntryEnabled())   Tr.entry(tc,"String_Node_Str",new Object[]{clientSubject,authType,jaspiRequest,provider});
  AuthenticationResult authResult=null;
  Subject serviceSubject=null;
  AuthStatus status=null;
  WebSecurityContext webSecurityContext=jaspiRequest.getWebSecurityContext();
  jaspiRequest.getHttpServletRequest().getServletContext().setAttribute("String_Node_Str",Boolean.toString(Boolean.TRUE));
  JaspiAuthContext jac=null;
  try {
    ServerAuthContext authContext=getServerAuthContext(jaspiRequest,provider);
    MessageInfo msgInfo=jaspiRequest.getMessageInfo();
    if (msgInfo != null) {
      msgInfo.getMap().put(JaspiConstants.SECURITY_WEB_REQUEST,jaspiRequest.getWebRequest());
    }
 else {
      if (tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
    }
    setRequestAuthType(jaspiRequest.getHttpServletRequest(),authType);
    if (webSecurityContext != null) {
      setRunSecureResponse(true,(JaspiAuthContext)webSecurityContext.getJaspiAuthContext());
    }
    if (tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str",new Object[]{"String_Node_Str" + authContext,clientSubject,msgInfo});
    }
    status=authContext.validateRequest(msgInfo,clientSubject,serviceSubject);
    if (tc.isDebugEnabled())     Tr.debug(tc,"String_Node_Str" + status);
    if (AuthStatus.SUCCESS == status || AuthStatus.SEND_SUCCESS == status) {
      Map msgInfoMap=msgInfo.getMap();
      if (msgInfoMap != null) {
        String session=(String)msgInfoMap.get("String_Node_Str");
        if (Boolean.valueOf(session).booleanValue()) {
          Map<String,Object> props=new HashMap<String,Object>();
          props.put("String_Node_Str",session);
          jaspiRequest.getWebRequest().setProperties(props);
        }
      }
      Object request=msgInfo.getRequestMessage();
      if (request != null && request != jaspiRequest.getHttpServletRequest()) {
        jaspiRequest.getHttpServletRequest().setAttribute("String_Node_Str",request);
      }
      Object response=msgInfo.getResponseMessage();
      if (response != null && response != jaspiRequest.getHttpServletResponse()) {
        jaspiRequest.getHttpServletRequest().setAttribute("String_Node_Str",response);
      }
      Subject callerSubject=doHashTableLogin(clientSubject,jaspiRequest);
      if (callerSubject != null && !callerSubject.getPrincipals().isEmpty()) {
        extraAuditData.put("String_Node_Str",callerSubject.getPrincipals().iterator().next().getName());
      }
      authResult=mapToAuthenticationResult(status,jaspiRequest,callerSubject);
      setRequestAuthType(msgInfo,jaspiRequest);
    }
 else {
      authResult=mapToAuthenticationResult(status,jaspiRequest,null);
    }
  }
 catch (  AuthException e) {
    AuthenticationException ex=new AuthenticationException("String_Node_Str" + e);
    ex.initCause(e);
    if (webSecurityContext != null) {
      setRunSecureResponse(false,(JaspiAuthContext)webSecurityContext.getJaspiAuthContext());
    }
    throw ex;
  }
catch (  WSLoginFailedException e) {
    AuthenticationException ex=new AuthenticationException("String_Node_Str" + e);
    ex.initCause(e);
    throw ex;
  }
  if (tc.isEntryEnabled())   Tr.exit(tc,"String_Node_Str",status);
  return authResult;
}

Fixed version (ground truth):
@FFDCIgnore({javax.security.auth.message.AuthException.class,com.ibm.websphere.security.auth.WSLoginFailedException.class}) private AuthenticationResult authenticate(Subject clientSubject,String authType,JaspiRequest jaspiRequest,AuthConfigProvider provider) throws AuthenticationException {
  if (tc.isEntryEnabled())   Tr.entry(tc,"String_Node_Str",new Object[]{clientSubject,authType,jaspiRequest,provider});
  AuthenticationResult authResult=null;
  Subject serviceSubject=null;
  AuthStatus status=null;
  WebSecurityContext webSecurityContext=jaspiRequest.getWebSecurityContext();
  jaspiRequest.getHttpServletRequest().getServletContext().setAttribute("String_Node_Str",Boolean.toString(Boolean.TRUE));
  JaspiAuthContext jac=null;
  try {
    ServerAuthContext authContext=getServerAuthContext(jaspiRequest,provider);
    MessageInfo msgInfo=jaspiRequest.getMessageInfo();
    setRequestAuthType(jaspiRequest.getHttpServletRequest(),authType);
    if (webSecurityContext != null) {
      setRunSecureResponse(true,(JaspiAuthContext)webSecurityContext.getJaspiAuthContext());
    }
    if (tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str",new Object[]{"String_Node_Str" + authContext,clientSubject,msgInfo});
    }
    status=authContext.validateRequest(msgInfo,clientSubject,serviceSubject);
    if (tc.isDebugEnabled())     Tr.debug(tc,"String_Node_Str" + status);
    if (AuthStatus.SUCCESS == status || AuthStatus.SEND_SUCCESS == status) {
      Map msgInfoMap=msgInfo.getMap();
      if (msgInfoMap != null) {
        String session=(String)msgInfoMap.get("String_Node_Str");
        if (Boolean.valueOf(session).booleanValue()) {
          Map<String,Object> props=new HashMap<String,Object>();
          props.put("String_Node_Str",session);
          jaspiRequest.getWebRequest().setProperties(props);
        }
      }
      Object request=msgInfo.getRequestMessage();
      if (request != null && request != jaspiRequest.getHttpServletRequest()) {
        jaspiRequest.getHttpServletRequest().setAttribute("String_Node_Str",request);
      }
      Object response=msgInfo.getResponseMessage();
      if (response != null && response != jaspiRequest.getHttpServletResponse()) {
        jaspiRequest.getHttpServletRequest().setAttribute("String_Node_Str",response);
      }
      Subject callerSubject=doHashTableLogin(clientSubject,jaspiRequest);
      if (callerSubject != null && !callerSubject.getPrincipals().isEmpty()) {
        extraAuditData.put("String_Node_Str",callerSubject.getPrincipals().iterator().next().getName());
      }
      authResult=mapToAuthenticationResult(status,jaspiRequest,callerSubject);
      setRequestAuthType(msgInfo,jaspiRequest);
    }
 else {
      authResult=mapToAuthenticationResult(status,jaspiRequest,null);
    }
  }
 catch (  AuthException e) {
    AuthenticationException ex=new AuthenticationException("String_Node_Str" + e);
    ex.initCause(e);
    if (webSecurityContext != null) {
      setRunSecureResponse(false,(JaspiAuthContext)webSecurityContext.getJaspiAuthContext());
    }
    throw ex;
  }
catch (  WSLoginFailedException e) {
    AuthenticationException ex=new AuthenticationException("String_Node_Str" + e);
    ex.initCause(e);
    throw ex;
  }
  if (tc.isEntryEnabled())   Tr.exit(tc,"String_Node_Str",status);
  return authResult;
}