싱글 사인온 프레임워크 정보

Build Forge® SSO 프레임워크에서는 업계에서의 여러 SSO 솔루션과 통합할 수 있는 기능을 제공합니다. SSO 프레임워크는 인터셉터 기반이므로, HTTP 요청을 인터셉트하고 해당 요청을 처리할 수 있는 메소드를 제공합니다. HTTP 요청에서 보안 아티팩트를 받고 유효성을 검증할 수 있도록 사용자 정의 인터셉터를 쓸 수 있습니다. 특히, 인터셉터에서 HTTP 응답에 토큰을 설정한 다음 연속 요청에서 해당 토큰을 찾을 수 있습니다.

다음과 같은 두 가지 SSO 솔루션이 Build Forge®와 함께 제공됩니다.

SSO 프레임워크 메소드

SSO 인터셉터는 Build Forge® SSO 프레임워크에서 사용되는 인터페이스를 구현하는 Java 클래스입니다.
com.buildforge.services.server.sso.ISSOInterceptor
이는 서비스 계층 컴포넌트에 있습니다.
<bfinstall>/Apache/tomcat/webapps/jas/WEB-INF/eclipse/plugins/com.ibm.jas-1.0.jar

인터페이스에서 다음 메소드를 제공합니다.

initInterceptor
인터셉터가 로드되면 호출됩니다. 구성 특성의 맵이 initInterceptor() 메소드에 전달됩니다. 구성 특성이 관리 > 보안 > SSO의 Build Forge 콘솔에서 작성됩니다.
isTargetInterceptor
인바운드 요청에서 속성을 검토하여 해당 속성에서 이 인터셉터를 작동해야 하는지 여부를 판별합니다. 작동해야 하는 경우 인터셉터에서 authenticateRequest() 메소드가 있는 요청을 인증해야 합니다. 그렇지 않으면 이 인터셉터를 건너뜁니다. 인터셉터 선택 시 다중 인터셉터가 구성되어 실행 중이라고 가정합니다. 해당 인터셉터가 순서대로 처리됩니다.
authenticateRequest
요청에 있는 데이터를 사용하여 요청을 인증합니다. 이는 응답 속성을 사용하여 클라이언트에 데이터를 다시 보냅니다.
logoutRequest
요청이 처리된 후 사용자 관련 보안 정보를 정리합니다.

인터셉터 구성 및 순서 지정

인터셉터 구성은 관리 > 보안 > SSO에 정의되어 있습니다. 다음 구성이 Build Forge®와 함께 제공됩니다.

인터셉터 클래스를 구현하고 해당 인터셉터 클래스를 Build Forge® Apache Tomcat 애플리케이션 서버에 배치한 후 해당 위치에 새 SSO 구성을 구성합니다. 클래스는 하나의 SSO 구성 특성입니다.

이 목록의 순서는 요청을 처리하기 위해 인터셉터가 참조되는 순서를 결정합니다. 다중 인터셉터를 구성하여 요청을 처리할 수 있습니다. 로그인 중에 각 인터셉터가 순서대로 참조됩니다. 요청을 처리하는 인터셉터는 속성이 요청에서의 속성에 적합한 첫 번째 활성 인터셉터입니다. 하나의 인터셉터에서만 요청을 처리합니다. 이러한 인터셉터는 항상 isTargetInterceptor에 대해 true를 응답하는 첫 번째 인터셉터입니다.

참고: 오류가 발생하는 경우 대체를 제공하려면 양식 SSO 인터셉터를 활성 상태로 두십시오. 대체를 제공하기 전에 목록에 사용자 정의 인터셉터를 배치하십시오.

사용자 정의 SSO 인터셉터 추가

Build Forge®에서 사용자 정의 인터셉터를 작성하려면 다음 단계를 완료하십시오.

  1. 사용자 정의 Java 클래스를 작성하십시오.

    클래스가 ISSOInterceptor 인터페이스를 구현해야 합니다.

  2. 서비스 계층 컴포넌트 WAR 파일에 사용자 정의 클래스를 배치하십시오.
    1. 컴파일된 SSO 인터셉터 클래스를 포함하는 JAR 파일을 작성하십시오.
    2. 다음 위치에서 Build Forge® 서비스 계층 JAR 파일에 JAR 파일을 병합하십시오(<bfinstall>/server/tomcat/work/Catalina/localhost/jas/eclipse/plugins/com.ibm.jas-xxx.jar).
    3. Build Forge®를 다시 시작하십시오.
  3. 환경을 정의하십시오. 이 환경은 initInterceptor() 메소드에 특성 오브젝트로 전달할 수 있습니다.
    1. 관리 콘솔에서 환경으로 이동하십시오.
    2. 환경 추가를 클릭하십시오.
    3. 초기화하기 위해 SSO 인터셉터에 필요한 모든 특성을 정의하십시오.
  4. Build Forge®에 SSO 인터셉터를 추가하십시오.
    1. 관리 콘솔에서 관리 > 보안 > SSO로 이동하십시오.
    2. SSO 구성 추가를 클릭하고 다음과 같은 특성을 입력하십시오.
      • 이름 - SSO 구성의 이름을 입력합니다.
      • 활성 - 로 설정합니다. 인증 요청 중에 모든 활성 구성에 액세스됩니다. 활성 구성은 이 패널에 표시되는 순서대로 액세스됩니다.
      • Java 클래스 - 클래스의 전체 패키지 이름을 입력합니다. 지정된 클래스는 하나의 SSO 인터셉터에만 지정할 수 있습니다.
      • 환경 - 이 SSO 인터셉터에 사용할 환경을 정의한 경우, 해당 환경을 선택합니다.
    3. 저장을 클릭하십시오.
    이제 SSO 인터셉터가 목록에 표시됩니다.
  5. SSO 인터셉터의 왼쪽에 있는 아이콘을 클릭하여 SSO 구성의 순서를 지정한 후 맨 위로 이동을 선택하십시오.

    요청하는 동안 이 패널에 표시되는 순서대로 활성 SSO 구성에 액세스됩니다. 사용자 구성은 기본적으로 활성 상태이고 액세스할 때 항상 true를 리턴하므로 해당 구성을 양식 SSO 구성 앞에 배치해야 합니다. 기본적으로 SPNEGO SSO 구성은 비활성 상태입니다.

예제 authenticateRequest 구현

다음 예제는 WebSphere Application Server 보안을 Build Forge®와 통합하는 데 사용되는 WebSphere SSO 인터섹터에서 가져옵니다.

인터셉터에서는 리플렉션을 사용하여 WebSphere 클래스 WSSubject를 찾습니다. 클래스에 AuthServlet에 로그인하는 데 사용되는 프린시펄을 리턴하는 getCallerPrincipal 메소드가 들어 있습니다. WebSphere Application Server에서 인증하기 전에 AuthServlet을 보호해야 합니다.

더 많은 정보를 리턴할 수 있는 기타 메소드를 사용할 수 있습니다. 모든 애플리케이션 서버에 대해 작업하는 데 유사한 메소드를 사용할 수 있습니다.

public Result authenticateRequest 
      (Request requestAttributes, Response responseAttributes) 
       throws SSOException {

  Result result = null;

try {
  Class<?> cl = 
    Class.forName(“com.ibm.websphere.security.auth.WSSubject”);
      Method theMethod = cl.getMethod("getCallerPrincipal", 
        (Class[])null);
    String principal = (String)theMethod.invoke((Object[])null, 
          (Object[])null);

if (principal != null 
      && principal.length() > 0 
      && !principal.equals("UNAUTHENTICATED")) {
  result = new Result(Result.UseridOnlyOID, domain, principal);
	responseAttributes.setStatus(HttpServletResponse.SC_OK);} catch (Exception e) {
				throw new SSOException(e);
}

return result;
}

authenticateRequest를 구현하는 동안 리턴하기 전에 응답 상태를 설정해야 합니다.

사용할 수 있는 추가 상태 값이 있습니다. HttpServletResponse의 JavaDoc를 참조하십시오.

로그인 오류 복구

테스트할 때 사용자 정의 인터셉터가 올바르게 작동되지 않는 경우 인증에 문제가 있을 수 있습니다. 다음 정보가 포함된 오류 페이지가 표시됩니다.

Build Forge Error

     Access is denied to the Build Forge console

     "Error authenticating:
     com.buildforge.services.common.api.APIException - API:
     Authentication Error."

     Please click here to try the same type of login again
     or click here to force a form login (user ID/password).

복구에 대한 다음과 같은 두 가지 옵션이 있습니다.

메소드 소스 목록

다음 주석 및 소스 목록은 ISSOInterceptor 인터페이스에서의 메소드에 대한 자세한 정보를 제공합니다.

initInterceptor
	/**
	 * This method is called when the interceptor is loaded.  A map of the 
     configuration properties is passed into the init method.  You can create 
     the configuration properties from a BuildForge Environment and associate 
     it with the SSO configuration.
	 *
	 * @param initializationProps used to configure the implementation
	 * @return true if successful, false if an error should be reported.
	 * @throws SSOException if the initialization fails
	 **/
	public boolean initInterceptor (Properties initializationProps) throws SSOException; 
isTargetInterceptor

	/**
	 * This methods will review the attributes in the requestAttributes Map 
     to determine if there is something that this interceptor should 
     act on.  If the interceptor return is "true", then the interceptor will 
     be responsible for authenticating the request and the authenticateRequest 
     method is invoked. If the interceptor return is "false", then this 
     interceptor is skipped and the next isTargetInterceptor in the list will 
     be called. Ordering of the interceptors during the configuration will 
     return which interceptor has the first shot at authenticating a request.
	 *
	 * @param requestAttributes attributes found in the inbound request	 
   * @return true if this interceptor will authenticate the request, 
             false if it will not.
	 * @throws SSOException
	 *
	 **/
	public boolean isTargetInterceptor(Request requestAttributes) throws SSOException;
	authenticateRequest

  /**
	 * This method is called on an interceptor that returns true for the 
     isTargetInterceptor method. The Request will contain data used 
     to perform the authentication.  The Response is for the interceptor 
     to send information back to the client.  The Result returned will contain 
     the following information if the status code is 200:
	 * 
	 * OID: an object identifier of the SecurityContext that can process token 
     information stored in this map when going to an Agent.
	 * Domain: a valid BF domain name or <default> if not known 
     (the username must be valid in the configured realm).
	 * Username:  a valid BF username.   This will be used to lookup BFUser attributes 
     that are used in checking authorization policy.
	 * @see com.buildforge.services.common.security.context.Result
	 * 
	 * @param requestAttributes attributes found in the inbound request
	 * @param responseAttributes sent back in the outbound response
	 * @return com.buildforge.services.common.security.context.Result - result 
          information that tells BF how to handle the authentication request.
	 * @throws com.buildforge.services.server.sso.SSOException
	 **/
	public Result authenticateRequest(
			Request requestAttributes, 
			Response responseAttributes)
		throws SSOException;
	logoutRequest

  /**
	 * This method is called to logout a request. The first interceptor that 
     returns true for the isTargetInterceptor method will perform the logout.   
     The main point is to clean up any user-related security information that 
     should not be kept.  The interceptor can inspect the request and response 
     objects to determine what needs to be removed.
	 * 
	 * @param requestAttributes attributes found in the inbound request
	 * @param responseAttributes sent back in the outbound response
	 * @return boolean - true if request redirect to exit page, 
                       false if redirect to login page.
	 * @throws com.buildforge.services.server.sso.SSOException
	 **/
	public boolean logoutRequest(
			Request requestAttributes, 
			Response responseAttributes)
		throws SSOException;

피드백