避免使用已淘汰的 WSSecurityHelper revokeSSOCookies 方法

此規則會標示 com.ibm.websphere.security.WSSecurityHelper 類別中下列已淘汰的方法:

此方法在 WebSphere Application Server Traditional 8.5 版中已淘汰,並可能在將來的版本中移除。 在 Liberty 中沒有此方法。

WSSecurityHelper.revokeSSOCookies(HttpServletRequest req, HttpServletResponse res) 所提供的功能由 Java Servlet-3.0 規格的 logout() 方法來取代。 Java Servlet-3.0 logout() 方法會執行 WSSecurityHelper.revokeSSOCookies(HttpServletRequest req, HttpServletResponse res) 所執行的所有工作,還會執行附加的狀態清除,例如,使階段作業失效並從執行緒中清除安全主題

請使用新的方法,以便在 WebSphere Application Server Traditional 及 Liberty 中皆相容。 另請注意,使用 logout() 方法時,應用程式需要 WebSphere Application Server 8.0 版或更新版本。

在原始檔掃描器中,快速修正程式會將 revokeSSOCookies(HttpServletRequest req, HttpServletResponse res) 呼叫取代為 logout() 方法呼叫。 比方說,下列程式碼

import javax.servlet.http.HttpServletRequest;
...
WSSecurityHelper.revokeSSOCookies(req, res);

會取代為

import javax.servlet.http.HttpServletRequest;
...
req.logout();

此規則具有自動化修正程式。 將自訂配置複製到應用程式建置檔以啟用它。

如需相關資訊,請參閱