JOSSO 웹로직 개발

[JAVA/Open Source Project]
아래 내용은 자바 웹 어플리케이션이 웹로직에서 운영되는 JOSSO 파트너 어플리케이션이 되기 위한 코딩 방법에 대한 내용을 기술하겠다.

JOSSO Agent설정하기
파트너 웹 어플리케이션이 운영되는 웹로직 웹컨테이너는 SSO Gateway에 도달하는 방법을 알아야 한다. 이것을 위해 josso-agent-config.xml 설정 파일은 컨테이너의 특정 디렉토리인 $DOMAIN_HOME에 위치 해야 한다.

아래 josso-agent.xml 환경파일을 먼저 살펴보자.

josso-agent-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<agent>
  <class>org.josso.wls92.agent.WLSSSOAgent</class>
  <gatewayLoginUrl>http://localhost:7001/josso/signon/login.do</gatewayLoginUrl>
  <gatewayLogoutUrl>http://localhost:7001/josso/signon/logout.do</gatewayLogoutUrl>

  <service-locator>
    <class>org.josso.gateway.WebserviceGatewayServiceLocator</class>
    <endpoint>localhost:7001</endpoint>
  </service-locator>
  <partner-apps>
      <partner-app>
          <context>/partnerapp</context>
      </partner-app>
      <partner-app>
          <context>/otherPartnerapp</context>
      </partner-app>
  </partner-apps>
</agent>

localhost:7001 은 SSO Gateway가 있는 호스트이름과 포트로 교체 해야 한다.
gatewayLoginUrl 과 gatewayLogoutUrl 의 정확한 호스트 이름과 포트를 사용하는것이 중요하다. 이것은 사용자가 로그인과 로그아웃을 시도할때 접속하는 URL로 설정 되어야 한다.

새로운 파트너 어플리케이션을 추가할때 여러분의 어플리케이션 컨텍스트를 사용해야 하고 여기서는 /partnerapp 과 /otherPartnerapp 으로 설정한 예를 보여주고 있다. 어플리케이션은 http://localhost:7001/partnerapp 과 http://localhost:7001/otherPartnerapp 에 접속 되어야 한다.

$DOMAIN_HOME/josso-config.xml 안에 josso-agent-config.xml 관한 설정 정보를 추가하여야 한다.
만약 Gateway와 Agent가 같은 서버에 위치한다면 josso-config.xml 파일은 아래와 같이 설정되어야 한다.
josso-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<configuration>
    <xml fileName="josso-agent-config.xml"/>
</configuration>

보안 제약 설정하기
 웹 어플리케이션 보안 제약

 
보안이 필요로 하는 웹 어플리케이션은  웹 리소스에 접속하기 위해 사용자에게 로그인을 요구한다. 사용자의 자격이 보안 영역에서 검증되고 한번 인증되면 사용자는 웹 어플리케이션 내에 있는 특정 리소스들의 접속 권한을 가질것이다.

웹 어플리케이션에서 보안은 세가지 엘리먼트를 사용하여 설정된다.

<login-config> 엘리먼트는 사용자가 어떻게 로그인 되는지 그리고 보안 영역의 위치를 명시한다. 만약 이 엘리먼트가 채워진다면 사용자는 <security-constraint> 에 의해 제약받는 모든 리소스에 접근하기 위해 인증되어야 한다.
<security-constraint>는 리소스 집합에 대한 접근 자격을 규정하는데 사용된다.
<security-role> 엘리먼트는 영역에서 그룹 혹은  상위자를 표현하기 위해 사용된다.이 엘리먼트는 <security-constraint> 엘리먼트 안에서 사용되며 <security-role-ref> 엘리먼트를 거쳐 서블릿코드에서 사용되는 alternative Role 이름에 연결될수 있다.

파트너 웹 어플리케이션의 완전한 web.xml은 아래와같다.

web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>JOSSO Partner Application</display-name>
    <welcome-file-list id="WelcomeFileList">
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <security-constraint>
        <!-- Sample Security Constraint -->
        <web-resource-collection>
            <web-resource-name>protected-resources</web-resource-name>
            <url-pattern>/*</url-pattern>
            <http-method>HEAD</http-method>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>role1</role-name>
        </auth-constraint>
        <user-data-constraint>
            <transport-guarantee>NONE</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-login-page>/wls-login-redirect.jsp</form-login-page>
            <form-error-page>/wls-login-redirect.jsp</form-error-page>
        </form-login-config>
    </login-config>
    <security-role >
        <description>The Role1</description>
        <role-name>role1</role-name>
    </security-role>
    <security-role >
        <description>The Role2</description>
        <role-name>role2</role-name>
    </security-role>
</web-app> 


위 web.xml파일은 role1과 관련된 사용자만이 파트너 어플리케이션에 접속할 수 있다는 것을 보여준다.

인증받지 않은 사용자가 파트너 어플리케이션의 접속을 요구할 때 '/partnerapp/login-redirect.jsp'  페이지로 이동될것이다. 이 jsp 페이지는 사용자를 JOSSO 로긴 폼으로 이동할 것이다.

주의 해야 할것은 <role-name>에 명기된 이름은 josso-gateway-config.xml  파일에 명기된 SQL Select 문을 사용하여 SSO Gateway에 의해 조회될 'ROLE' 데이터베이스 테이블 입력값이어야 한다.

지금 우리는 어플리케이션 Role들을 규정된 원칙과 맵핑하기 위해 새로운 디스크립터를 추가해야한다. 아래 예는 원칙(principal 엘리먼트)들이 Role과 같은 이름을 가지고 있음을 알수있다. 

weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
  xmlns="http://www.bea.com/ns/weblogic/90"
  xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
         http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd"
>
  <security-role-assignment>
    <role-name>role1</role-name>
    <principal-name>role1</principal-name>
  </security-role-assignment>
  <security-role-assignment>
    <role-name>role2</role-name>
    <principal-name>role2</principal-name>
  </security-role-assignment>
</weblogic-web-app>


Redirect 페이지 생성
서블릿 컨테이너가 사용자가 보호되는 리소스에 접근함을 인지했을때 서블릿 컨테이너는 /partnerapp/wls-login-redirect.jsp 페이지로 재 전송 할 것 이다.

파트너 어플리케이션에 추가할 login-redirect.jsp 는 아래와 같다.
login-redirect.jsp
<%@page contentType="text/html; charset=iso-8859-1" language="java" session="true" %>
<!--
Redirects the user to the propper login page.  Configured as the login url the web.xml for this application.
-->
<%
    response.sendRedirect(request.getContextPath() + "/josso-wls/josso_login.jsp");
%>
이 jsp 페이지는 사용자를 특별한 URI로 재 전송할 것이다. 이 URI는 SSO Agent 에게 사용자를 SSO Gateway의 로그인 폼으로 재 전송하라고 알리게 될 URI이다.

웹 어플리케이션에 3개의 jsp페이지를 카피하거나 만들어야 한다.
  • /josso-wls/josso_login.jsp
  • /josso-wls/josso_logout.jsp
  • /josso-wls/josso_security_check.jsp
  • 위 페이지들은 아무짓도 안하며 결고 실행되지 않으며 404 NOT FOUND HTTP 코드를 리턴한다. JOSSO Agent는 특정 리소스에 대한 요구를 가로채서 적절하게 행동한다.  이 파일들은 wls-login-redirect.jsp 로 부터 리다이텍트될 때
    웹로직이 리소스를 요구하기 때문에 단지 필요하다. 이 파일들은 JOSSO 배포 모듈에서 제공된다. 아래는 배포 모듈에 포함된 파일과 같은 소스들이다.

    josso_login.jsp

    <%response.sendError(javax.servlet.http.HttpServletResponse.SC_NOT_FOUND);%>

    파트너 어플리케이션은 사용자 로그아웃을 허용해야만 한다.  사용자로 하여금 다음 방식으로 리다이렉트 함으로써 이액션은 SSO Gateway로 전달 되어야만 한다.

    sample-logout.jsp
    <%@page contentType="text/html; charset=iso-8859-1" language="java"
                session="true" %>
    <html> ... <a href="<%=request.getContextPath() + "/josso-wls/josso_logout.jsp"%>LOGOUT</a>
    ...
    </html>
    SSO Agent는 사용자를 josso-agent-config.xml 파일의 <gatewayLogoutUrl> 엘리먼트에 있는 URL로 리다이렉트하는 요구를 인터셉트 할것이다.

    파트너 어플리케이션 빌드하기
     파트너 어플리케이션은 여느때처럼 WEB-INF/web.xmlWEB-INF/weblogic.xml 을 포함하여 빌드한다.

    파트너 어플리케이션 디폴로이
     개발모드로 웹로직을 사용하는 경우에는 $DOMAIN_HOME/autodeploy/ 에 WAR 혹은 EAR 파일을 두어야 한다.

    테스트 하기
     웹 브라우져를 사용하여 다음 URI : *http://localhost:7001/partnerapp/* . 로 접속한다.

    partnerapp대신에 웹 어플리케이션의 웹 컨텍스트 이름을 사용한다.
    JOSSO Gateway 에 위치한 Geateway SSO logon 폼을 http://localhost:7001/josso/signon/login.do. 로 리다이렉트 되어야 한다.

    인증
     로그온 폼이 보여졌을때 사용자 테이블에 사전에 입력된 user/password 중 하난를 사용하여 로그온한다. role1 과 연관되어 있는 user1이라는 사용자로 로그온한다. 이 롤은 파트너 웹 어플리케이션을 접속하기 위해 권한을 부여하는것으로 web.xml파일에 설정된다.

    인증 시 사용자는 파트너 어플리케이션으로 리다이렉트 될것이다.

    파트너 어플리케이션 접속
     파트너 어플리케이션에서 로그인된 사용자 정보를 얻기위해 표준 Servlet Security API를 사용하여 가능할것이다.

    아래 예는 어떻게 이것이 행해지는지 보여주는 예이다.

    sample-protected.jsp
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
    	<title>Sample Partner Application - JOSSO</title>
    </head>
    
    <body>
        <p>This is a very simple JOSSO partner application</p>
        <p>Your username is : <b><%=request.getRemoteUser()%></b>&nbsp;
        <font color="red">(Retrieved from request.getRemoteUser())</font></p>
    </body>
    </html>
    위 소스의 실행결과는 아래와 같을것이다.
    Sample Partner Application - JOSSO
    This is a very simple JOSSO partner application
    
    Your username is : user1 (Retrieved from request.getRemoteUser())
    위 예는 JSP 파트너 웹 어플리케이션을 사용한 예이고 모든 자바 웹 어플리케이션(Servlet, Struts, etc.)
    을 보호할 수 있으며 롤들은 표준 Java Security API를 사용하여 활용될수 있다.
    Custom User Properties 사용하기
    이전 샘플 환결 파일 에서 본것처럼 <userPropertiesQueryString> 엘리먼트를 이용하여 SSO Gateway가 커스텀 프로퍼티들을 principal 에 포함 가능하게 만든다. 그러한 principal 은 표준 서블릿 Security API 를 사용하여 파트너 웹 어플리케이션에서 사용될 수 있다. Servlet Security API는 파트너 어플리케이션에게 부가적인 사용자 프로퍼티들을 접속하게 해준다.
    이러한 프로퍼티들은 org.josso.gateway.SSONameValuePair 클래스 인스턴스의 배열로 org.josso.gateway.identity.SSOUser 클래스 인스턴스에 저장된다.

    그러한 프로퍼티들에 접속하기 위해 아래 방법처럼 HttpServletRequest 와 연관되는 사용자 Principal를
    캐스트(형 변환) 해야할것이다.


    sample-protected.jsp
    ...
    <%  // Check if we have a principal ...
        if (request.getUserPrincipal() != null)
        { %>
            <p>Your username is : <b><%=request.getRemoteUser()%></b>&nbsp;
            <font color="red">(Retrieved from request.getRemoteUser())</font></p>
    <%      // Cast the principal to a josso specific user,
            //and iterate over its properties.
            org.josso.gateway.identity.SSOUser ssoUser =
                        (org.josso.gateway.identity.SSOUser)
                                        request.getUserPrincipal();
            for (int i = 0 ; i < ssoUser.getProperties().length ; i++)
            { %>
                <p><%=ssoUser.getProperties()[i].getName()%> :
                <%=ssoUser.getProperties()[i].getValue()%> </p>
    <%      } %>
    <%  }
    보다 자세한 내용은 JOSSO 배포판의 src/webapp/samples/partnerapp/josso 디렉토리에 위치한 샘플을 
    검토하면 된다. 혹은 here
     
     
     
     
    크리에이티브 커먼즈 라이선스
    Creative Commons License
    TAG. JOSSO

    Weblogic9.2에서 Agent 설정하기

    [JAVA/Open Source Project]

    Agent 의 주요 기능은 사전에 SSO Gateway를 통해 로깅된 사용자가 사전에 권한부여를 받았는지 검사하는 것이다. Agent는 SSO 웹 서비스 인프라스트럭쳐(인증 시 SSO Gateway에 의해 세팅되는 특별한 쿠키를 사용)를 SOAP을 통해 조회함으로써 인증 정보를 검증한다.

    josso-config.xml
    이 xml 파일은 josso 행위를 설정하는데 사용되는 여러 환경 설정 파일들을 선언하기 위해 사용되는 마스터 설정 파일이다.

    이 파일은 $DOMAIN_HOME  디렉토리에 위치 되어야 한다.

    아래는 설정 예이다.
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <configuration>
        <!-- Comment if no agent runs in this server -->
        <hierarchicalXml fileName="josso-agent-config.xml"/>
        <!-- Comment if no gateway runs in this server -->
        <hierarchicalXml fileName="josso-gateway-config.xml"/>
    </configuration>
    위 설정 예는 josso-agent-config.xml 파일을 임포트 하라고 설명하고 있다. josso-config.xml 파일에 설정된 모든 환경 설정 파일들은 josso-config.xml 파일이 있는 $DOMAIN_HOME 에 위치 되어야 한다.

    주의
    Agent와 Gateway 를 같은 서버에서 운영할 경우 josso-gateway-config.xml파일을 $DOMAIN_HOME 디렉토리에 복사하고 josso-config.xml파일에서  josso-gateway-config.xml을 임포트 해야 한다.

    Agent 설정하기
     SSO Agent 설정파일은 $WEBLOGIC_HOME/server/default/conf 디렉토리에 있어야 하며 josso-config.xml파일에 의해 참조(임포트)되어야 한다.

    아래는 Agent 설정 파일의 예이다.
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <agent>
      <class>org.josso.wls92.agent.WLSSSOAgent</class>

      <!-- Modify this URLs and replace localhost with the proper host name -->
      <gatewayLoginUrl>http://localhost:7001/josso/signon/login.do</gatewayLoginUrl>
      <gatewayLogoutUrl>http://localhost:7001/josso/signon/logout.do</gatewayLogoutUrl>

      <sessionAccessMinInterval>1000</sessionAccessMinInterval>

      <service-locator>
        <class>org.josso.gateway.WebserviceGatewayServiceLocator</class>
        <endpoint>localhost:7001</endpoint>
      </service-locator>
      <partner-apps>
          <partner-app>
              <context>/partnerapp</context>
          </partner-app>
      </partner-apps>
    </agent>

    위의 예에서 gatewayLoginUrlgatewayLogoutUrl 은 적당한 호스트 명으로 변경 해야 한다. 만약 gateway가 같은 서버에서 운영되지 않는다면 endpoint 엘리먼트 값을 변경 해야 한다. 예를 들자면 192.168.1.99:8080 
    위 환경 파일을 이용하여 설정 가능한 항목

     - Gateway Login URL : 사용자 인증 요구 시 재 전송할 URL
     - Gateway Logout URL : 사용자 로그아웃요청을 재 전송할 URL
     - 인스턴스될 구체적인 SSO Agent
     - 호출될 SSO Gateway 서비스 위치
     - 파트너 어플리케이션의 웹 컨텍스트

    endpoing 환경 설정 값에는 SSO 웹 서비스가 위치한 호스트와 포트 정보를 포함해야 한다.
    Agent 와 Gateway가 같은 서버에 위치할 경우에는 localhost와 Http 요청를 받아주는 웹로직 리슨 포트로 설정해야 한다. 

    한개 이상의 파트너 어플리케이션 지정이 가능하다.

    새로운 인증자 설정하기 
    SSO Gateway와 Agent가 설치되고 환경 설정이 완료 된후 웹로직 어드민 콘솔을 이용하여 새로운 인증 제공자를 설정해야 한다. 웹로직이 스타트되어있지 않으면 $DOMAIN_HOME/bin 디렉토리로 가서 웹로직을 스타트한다.

    Unix상에서 스타트 예
    $ ./startWeblogic.sh

    스타트가 된후 웹로직 어드민 콘솔로 접속한다.
    어드민 콘솔에서 설정하기
    1. "Security Realms" 클릭한다.

    2. 새로운 Authentication Provider 를 등록한다. 아래 화면은 myrealm 이름의 Authentication Provider 를 추가한 화면을 보여준다.

    3. providers 메뉴 탭을 선택하면 아래 리스트를 볼수 있을 것이다.

    4. 위 3번 화면의 리스트 밑에 3개 버튼 중 New 버튼을 클릭하여 JOSSO Authenticator를 추가한다.
    이름을 JOSSO Authenticator 명명하고 타입을 리스트 박스에서 JOSSOAuthenticator로 선택한다.

    5. 3번 화면 밑 3개 버튼 중 Reorder 버튼을 눌러 JOSSO Authenticator 리스트 제일 상단에 위치시킨다.

    6. Authenticator 의 컨트롤 플래그를 SUFFICIENT 로 설정 (웹로직이 사용자를 인증하도록 허용하기 위해 설정)

    7. Save 버튼을 눌러 저장 후 웹로직을 리스타트 시킨다.

    Reference
    http://www.josso.org/confluence/display/JOSSO1/Weblogic+9.2




     


    크리에이티브 커먼즈 라이선스
    Creative Commons License
    TAG. JOSSO, weblogic

    Weblogic9.2에 JOSSO Gateway 설정하기

    [JAVA/Open Source Project]

    JOSSO 설정 시 주의 사항

    - JOSSO는 JDK1.5 이상 버젼으로 설치 필요
    - 웹로직 버젼은 9.2로 설치(다른 버젼은 작동은 될지라도 테스트가 안됨 : 2008년 9월 현재)

    사전 작업

    JAVA_HOME환경 변수 설정 필요
    -UNIX
     $ export JAVA_HOME=/usr/local/jdk1.5.0_13
    -Win32
     set JAVA_HOME=c:\jdk1.5.0_13

    웹로직 환경 변수 설정
    - UNIX
    $ export WL_HOME="/opt/bea/weblogic92"
    $ export DOMAIN_HOME="$WL_HOME/samples/domains/wl_server"
    -Win32
    set WL_HOME=c:\bea\weblogic92
    set DOMAIN_HOME=%WL_HOME%\samples\domains\wl_server

    빌드 작업
    - UNIX
    $ ./build.sh -Dinclude.plugin.wls92=true build-wls92
    - Win32
     build.bat -Dinclude.plugin.wls92=true build-wls92

    중요
    웹로직 플러그인 옵션이 디폴트로 False 이기 때문에 빌드 시
    -Dinclude.plugin.wls92=true 옵션 설정이 중요함(build.properties 설정 파일에서 변경 가능)

    성공적으로 설치 완료 시 ./build/josso- 안에 아래와 같은 파일들을 볼 수 있다.
    JOSSO 1.7 버젼 시
    - josso.ear
    - josso- 1.7.jar
    - josso-common- 1.7.jar

    또한 ./build/josso- 안에 wls92 플러그인 파일들을 볼 수 있다.
    디렉토리 : /plugins/wls92/
    - wl-josso- 1.7.jar
    - wl-josso-web- 1.7.jar
    - wl-josso-wsl92-plugin-mbeans- 1.7.jar

    설치 작업
    성공적인 JOSSO 컴파일이 끝난 후 웹로직에서 운영될 JOSSO 코어 jar파일을 설치 해야 한다.
    - UNIX
    $ ./build.sh -Dinclude.plugin.wls92=true deploy-wls92
    - Win32
    build.bat -Dinclude.plugin.wls92=true deploy-wls92
    이 절차는 한번만 이루어져야 하며 아래의 파일들을 해당 디렉토리에
    복사 할것이다. gateway 나 agent 에 디폴로이 되었을때 사용되지 않는 파일은
    삭제 가능하다.

    복사 디렉토리 : $DOMAIN_HOME/lib
    복사 파일 : wl-josso-1.7.jar
                josso-common-1.7.jar
    용도 : gateway and agent 에서 사용

    복사 디렉토리 : $DOMAIN_HOME/lib/mbeantypes
    복사 파일 : wl-josso-wsl92-plugin-mbeans-1.7.jar
    용도 : agent 에서 사용

    복사 디렉토리 : $DOMAIN_HOME/autodeploy
    복사 파일 : josso.ear
    용도 : gateway 에서 사용

    복사 디렉토리 : $DOMAIN_HOME/autodeploy
    복사 파일 : josso.ear
    용도 : gateway 에서 사용 

    josso.ear 디플로이 작업
     - 웹로직이 개발 모드에서 운영되지 않는다면 josso.ear파일은 어드민 컨솔을 사용하여 디폴로이
       되어야 한다.
     - DOMAIN_HOME환견 변수에 참조 되는 웹로직 도메인에 설치된다.

    Setup

    Single Sign-On Gateway 환경 설정
    Gateway 는 인증체계와 신원 저장소를 이용하여 웹 사용자의 인증을 중앙 통제하는 책임을 맡고있다.

    josso-config.xml
    josso-config.xml 파일은 마스터 환경 파일이며 JOSSO의 행위를 설정하기 위해 사용되는 환경파일들을 선언하기 위해 사용된다.

    이 파일은  Gateway 가 알수 있도록 $DOMAIN_HOME 디렉토리에 있어야 한다.
     
    josso-config.xml파일 예

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <configuration>
        <!-- Comment if no agent runs in this server -->
        <hierarchicalXml fileName="josso-agent-config.xml"/>
        <!-- Comment if no gateway runs in this server -->
        <hierarchicalXml fileName="josso-gateway-config.xml"/>
    </configuration>

    이 환경 파일을 이용하여 JOSSO는 josso-gateway-config.xml  환경파일을 임포트 하라고 알려준다.
    josso-config.xml파일에 참조되는 모든 파일은 $DOMAIN_HOME 디렉토리에 있어야 한다.

    Agent는 자기 자신의 환경파일을 가지고 있다. 만약 같은 서버에서 Gateway와 Agent가 운영된다면
    josso-agent-config.xml  파일을 $DOMAIN_HOME 디렉토리에 복사해야한다.

    인증 체계는 자격에 근거를 두어 사용자의 신원을 검증하기 위해 사용되는 보안 메커니즘이다. 샘플 인징 체계는
    username/password 혹은 인증서 기반 인증이다.

    사용자의 자격 정보는 퍼시스턴스 메커니즘을 이용하여 저장되어야 한다.
    자격 저장소는 사용자의 자격 정보가 저장되는 곳이다. 샘플 자격 저장소는 DB 와 LDAP이다.

    JOSSO의 중요한 특징 중의 하나는 인증체계와 Single Sign-On Gateway 환경 파일을 사용하여 자격 저장소와
    결합하는것을 허용한다.

    다음은 Single Sign-On Gateway 환경파일 예이다.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <domain>
      <name>SampleDomain</name>
      <type>web</type>
      <authenticator>
    <class>org.josso.auth.AuthenticatorImpl</class>
    <authentication-schemes>
        <!-- Basic Authentication Scheme -->
        <authentication-scheme>
          <name>basic-authentication</name>
          <class>org.josso.auth.scheme.UsernamePasswordAuthScheme</class>

          <!-- ========================================================= -->
          <!-- JDBC Credential Store                                     -->
          <!-- ========================================================= -->
          <credential-store>
           <class>
           org.josso.gateway.identity.service.store.db.JDBCIdentityStore
           </class>
           <credentialsQueryString>
           SELECT login AS username , password AS password FROM josso_user
           WHERE login = ?
           </credentialsQueryString>
           <connectionName>SCOTT</connectionName>
           <connectionPassword>TIGER</connectionPassword>
           <connectionURL>jdbc:oracle:thin:@mydbhost:1521:mydb</connectionURL>
           <driverName>oracle.jdbc.driver.OracleDriver</driverName>
          </credential-store>

          <credential-store-key-adapter>
        <class>
        org.josso.gateway.identity.service.store.SimpleIdentityStoreKeyAdapter
        </class>
          </credential-store-key-adapter>

        </authentication-scheme>

    </authentication-schemes>
      </authenticator>

      <sso-identity-manager>
    <class>org.josso.gateway.identity.service.SSOIdentityManagerImpl</class>
    <!-- ========================================================= -->
    <!-- JDBC Identity Store                                       -->
    <!-- ========================================================= -->
    <sso-identity-store>
      <class>
      org.josso.gateway.identity.service.store.db.JDBCIdentityStore
      </class>
      <userQueryString>
       SELECT login FROM josso_user WHERE login = ?
      </userQueryString>
      <rolesQueryString>
    SELECT josso_role.name FROM josso_role , josso_user_role , josso_user
    WHERE josso_user.login = ? AND josso_user.login = josso_user_role.login
    AND josso_role.name = josso_user_role.name
       </rolesQueryString>
       <connectionName>SCOTT</connectionName>
       <connectionPassword>TIGER</connectionPassword>
       <connectionURL>jdbc:oracle:thin:@mydbhost:1521:mydb</connectionURL>
       <driverName>oracle.jdbc.driver.OracleDriver</driverName>
    </sso-identity-store>

    <sso-identity-store-key-adapter>
      <class>
      org.josso.gateway.identity.service.store.SimpleIdentityStoreKeyAdapter
      </class>
    </sso-identity-store-key-adapter>
      </sso-identity-manager>

      <sso-session-manager>
    <class>org.josso.gateway.session.service.SSOSessionManagerImpl</class>

    <!--
    Set the maximum time interval, in minutes, between client requests
    before the SSO Service will invalidate the session. A negative time
    indicates that the session should never time out.
    -->
    <maxInactiveInterval>1</maxInactiveInterval>

    <sso-session-store>
      <class>
      org.josso.gateway.session.service.store.MemorySessionStore
      </class>
    </sso-session-store>

    <sso-session-id-generator>
      <class>
       org.josso.gateway.session.service.SessionIdGeneratorImpl
      </class>
      <!--
      The message digest algorithm to be used when generating session
      identifiers.  This must be an algorithm supported by the
      java.security.MessageDigest class on your platform.

      In J2SE 1.4.2 you can check :
      Java Cryptography Architecture API Specification & Reference -
      Apendix A : Standard Names
      Values are : MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512
      -->
      <algorithm>MD5</algorithm>
    </sso-session-id-generator>
    </sso-session-manager>

    <sso-audit-manager>
      <class>org.josso.gateway.audit.service.SSOAuditManagerImpl</class>
      <handlers>

        <!-- This handler logs all audit trails using Log4J, under the given category -->
        <handler>
          <class>org.josso.gateway.audit.service.handler.LoggerAuditTrailHandler</class>
            <name>LoggerAuditTrailHandler</name>
            <category>org.josso.gateway.audit.SSO_AUDIT</category>
        </handler>
      </handlers>
    </sso-audit-manager>

        <!-- SSO Event Manager component -->
    <sso-event-manager>
      <class>org.josso.gateway.event.security.JMXSSOEventManagerImpl</class>
      <!--
      JMX Name of the EventManager MBean that will send SSO Events as JMX Notifications
      The MBean will be registered by the MBeanComponentKeeper.
      -->
      <oname>josso:type=SSOEventManager</oname>
    </sso-event-manager>


    </domain>


    Authenticator 설정
    Authenticator 는 구체화된 인증 체계를 실현하는 책임을 가지는 컴포넌트인다.
    구현되기 위해 인증 체계는 authentication-schemes의  차일드인 class 엘리먼트 안에 놓여야 한다.

    username/password형태의 인증 체계를 위해서는 org.josso.auth.scheme.UsernamePasswordAuthScheme.로 설정해야 한다.

    신원 확인 시 사용자의 자격을 획득하기 위해 사용되는 퍼시스턴스 메커니즘을 위해 <credential-store>
    엘리먼트의 <class> 차일드 엘리먼트를 org.josso.gateway.identity.service.store.db.JDBCIdentityStore
    로 설정해야한다.

    JDBC 이용 시 사용자의 username과 password 를 가져오는 SQL Query 를 credentialsQueryString  엘리먼트에 설정해야 한다.

    DB 퍼시스턴스 메커니즘을 사용 시에는 또한 connectionName, connectionPassword, connectionURL,  driverName 엘리먼트 값을 설정 해야 한다.

    Identity Manager 엘리먼트 설정
    사용자의 인증을 책임지는 컴포넌트

    identity Manager 엘리먼트는 identity-manager 의 차일드 엘리먼트인 <class>엘리먼트를 설정해야한다.  
    디펄트 identity Manager 를 사용하기 위해서는 엘리먼트 값을 org.josso.gateway.identity.service.SSOIdentityManagerImpl.로 설정해야 한다.
    DB 퍼시스턴스 메커니즘을 사용하기 위해서는 sso-identity-store 의 차일드 엘리먼트인 <class>엘리먼트를 org.josso.gateway.identity.service.store.db.JDBCIdentityStore 로 설정해야한다.
    JDBC 이용 시 username 값을 가져오기 위해 userQueryString 엘리먼트 값에 SQL Select 쿼리로 설정해야 한다.
    획득된 username은 rolesQueryString 에 설정된 SQL Select 쿼리를 실행하여 사용자의 롤(Role)값을 가져오는데 사용된다. 

    DB 퍼시스턴스 메커니즘을 사용 시에는 또한 connectionName, connectionPassword, connectionURL,  driverName 엘리먼트 값을 설정 해야 한다.

    Session Manager 설정
     세션 매니저는 SSO 사용자 세션의 라이프사이클을 관리하는 책임을 지고 있다. 성공적인 사용자 인증을 위해 SSO Gateway는 세션 매니저를 사용하여 새로운 SSO 세션을 생성한다.

    Session Manager 는 디폴트 설정을 사용해도 크게 문제가 없다.

    Audit Manager 설정
     Audit 매니저는 SSO 이벤트를 Audit 핸들러에게 전달하는 역활을 한다.
     Audit Manager 는 디폴트 설정을 사용해도 크게 문제가 없다.

    Event Manager 설정
     이벤트 매니져는 세션 라이프사이클과 인증 요청과 같은 SSO 이벤트들을 전달하는 역활을 한다. 인증 실패 같은 특정 SSO 이벤트를 대표하여 행동하도록 이벤트 리스너에 등록할 수 도 있다. 비록 이벤트들이 JMS 버스를 통해 전달될지라도 리스너들은 JMX api를 다룰 필요가 없다. 왜냐하며 JOSSO 이벤트 인프라가 이런 작업을 하기 때문이다.

    Event Manager 는 디폴트 설정을 사용해도 크게 문제가 없다.


    Reference
    http://www.josso.org/confluence/display/JOSSO1/Weblogic+9.2

    크리에이티브 커먼즈 라이선스
    Creative Commons License
    TAG. gateway, JOSSO