Build Forge® SSO 프레임워크에서는 업계에서의 여러 SSO 솔루션과 통합할 수 있는 기능을 제공합니다. SSO 프레임워크는 인터셉터 기반이므로, HTTP 요청을 인터셉트하고 해당 요청을 처리할 수 있는 메소드를 제공합니다. HTTP 요청에서 보안 아티팩트를 받고 유효성을 검증할 수 있도록 사용자 정의 인터셉터를 쓸 수 있습니다. 특히, 인터셉터에서 HTTP 응답에 토큰을 설정한 다음 연속 요청에서 해당 토큰을 찾을 수 있습니다.
다음과 같은 두 가지 SSO 솔루션이 Build Forge®와 함께 제공됩니다.
com.buildforge.services.server.sso.ISSOInterceptor
이는
서비스 계층 컴포넌트에 있습니다.<bfinstall>/Apache/tomcat/webapps/jas/WEB-INF/eclipse/plugins/com.ibm.jas-1.0.jar
인터페이스에서 다음 메소드를 제공합니다.
인터셉터 구성은 Build Forge®와 함께 제공됩니다.
에 정의되어 있습니다. 다음 구성이인터셉터 클래스를 구현하고 해당 인터셉터 클래스를 Build Forge® Apache Tomcat 애플리케이션 서버에 배치한 후 해당 위치에 새 SSO 구성을 구성합니다. 클래스는 하나의 SSO 구성 특성입니다.
이 목록의 순서는 요청을 처리하기 위해 인터셉터가 참조되는 순서를 결정합니다. 다중 인터셉터를 구성하여 요청을 처리할 수 있습니다. 로그인 중에 각 인터셉터가 순서대로 참조됩니다. 요청을 처리하는 인터셉터는 속성이 요청에서의 속성에 적합한 첫 번째 활성 인터셉터입니다. 하나의 인터셉터에서만 요청을 처리합니다. 이러한 인터셉터는 항상 isTargetInterceptor에 대해 true를 응답하는 첫 번째 인터셉터입니다.
Build Forge®에서 사용자 정의 인터셉터를 작성하려면 다음 단계를 완료하십시오.
클래스가 ISSOInterceptor 인터페이스를 구현해야 합니다.
요청하는 동안 이 패널에 표시되는 순서대로 활성 SSO 구성에 액세스됩니다. 사용자 구성은 기본적으로 활성 상태이고 액세스할 때 항상 true를 리턴하므로 해당 구성을 양식 SSO 구성 앞에 배치해야 합니다. 기본적으로 SPNEGO SSO 구성은 비활성 상태입니다.
다음 예제는 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를 구현하는 동안 리턴하기 전에 응답 상태를 설정해야 합니다.
responseAttributes.setStatus(HttpServletResponse.SC_OK);
responseAttributes.setStatus(HttpServletResponse,SC_FORBIDDEN);
responseAttributes.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
responseAttributes.sendRedirecct(url);
사용할 수 있는 추가 상태 값이 있습니다. 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;