WebSphere Application Server API를 사용하여 LtpaToken2 쿠키로 다운스트림 웹 싱글 사인온을 수행할 수 있습니다.
애플리케이션이 사용자 신임 정보를 저장 및 전송할 필요없이 LTPA(Lightweight Third Party Authentication) 쿠키의 다운스트림 싱글 사인온(SSO) 웹 전파를 프로그래밍 방식으로 수행할 수 있습니다.
WebSphere® Application Server는 LtpaToken2 쿠키를 다운스트림 웹 싱글 사인온 애플리케이션으로 전파를 지원하는 API를 제공합니다.
미드티어 WebSphere 서버에서 실행 중인 웹 애플리케이션은 다운스트림 웹 호출에서 LtpaToken2 쿠키를 전파해야 할 수도 있습니다. WebSphere Application Server의 이 릴리스에서 새 API(Application Programming Interface)가 애플리케이션이 사용자 신임 정보를 저장 및 전송할 필요 없이 다운스트림 SSO를 애플리케이션 개발자가 프로그래밍 방식으로 수행할 수 있도록 제공됩니다.
그림 1. 다운스트림 인증에 LTPA 쿠키 API 사용

이 기능은 패키지 com.ibm.websphere.security.WSSecurityHelper의 공용 API이며
다음과 같이 정의됩니다.
/**
* Extracts an LTPA sso token from the subject of current
* thread and builds a ltpa cookie out of it for use on
* downstream web invocations.
* When the returned value is not null use Cookie methods
* getName() and getValue() to set the Cookie header
* on an http request with header value of
* Cookie.getName()=Cookie.getValue()
*
* @return an object of type javax.servlet.http.Cookie.
*
*/
다음은 새 WSSecurityHelper API를 사용하는 방법에 대한 예입니다.
제거된 기능: WSSecurityHelper 클래스의 getLTPACookieFromSSOToken() 메소드는
더 이상 사용되지 않습니다. WebSecurityHelper 클래스의 getSSOCookieFromSSOToken() 메소드에서
제공되는 기능을 사용하십시오. depfeat
import javax.servlet.http.Cookie;
import com.ibm.websphere.security.WSSecurityHelper;
Cookie ltpaCookie = WSSecurityHelper.getLTPACookieFromSSOToken()

이후에 LTPA 쿠키는 HTTP 요청 헤더에 설정 가능합니다.
이런 경우, 쿠키 헤더 값은 문자열입니다.
ltpaCookie.getName()=ltpaCookie.getValue()
예를 들어, org.apache.commons.httpclient.HttpMethod를 사용하여 HTTP 요청을 빌드하는 경우 LTPA 쿠키는 다음과
같이 설정 가능합니다.
HttpMethod method = .; // new your HttpMethod based on the
// target URL for the web application
if (ltpaCookie != null)
method.setRequestHeader(“Cookie”, ltpaCookie.getName()+”=”+ltpaCookie.getValue());
참고: SSL 연결을 통해서만 LTPA 쿠키를 전송해야 합니다.
참고: 이전 예제에서 WSSecurityHelper.getLTPACookieFromSSOToken() 호출로 리턴되는 LTPA 쿠키가
getter 메소드 발행 전에 null이 아니도록 확인해야 합니다.
또한, LTPA 쿠키 오브젝트를 성공적으로 검색하고 실행 스레드에서 SSO 토큰을 확인하려면
사용자가 미드티어 서버와 성공적인 인증을 설정하도록 해야 합니다.
참고: WebSphere Application
Server는 Apache httpclient와 같은 HTTP 프로그래밍을 위한 지원 jar을 제공하지 않습니다. HTTP 프로그래밍에
대해 자체 지원 기능을 제공해야 합니다.