[CAS] CAS Client 설정 기초 가이드 - Java Web Application
아래 사이트에서 최신버전 CAS Client를 다운받습니다.
http://www.ja-sig.org/downloads/cas-clients/cas-client-3.1.10-release.zip
다운 받은 라이브러리에서 /modules 디렉토리에 있는 jar 파일들을 /WEB-INF/lib 에 배포합니다.
Web application의 web.xml에 다음과 같은 servlet-filter를 추가합니다.
<!-- CAS:START - Java Client Filters --> <filter> <filter-name>CasSingleSignOutFilter</filter-name> <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> </filter> <filter> <filter-name>CasAuthenticationFilter</filter-name> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> <init-param> <param-name>casServerLoginUrl</param-name> <param-value>https://cas.institution.edu/cas/login</param-value> </init-param> <init-param> <param-name>serverName</param-name> <param-value>https://jira.institution.edu/jira/</param-value> </init-param> </filter> <filter> <filter-name>CasValidationFilter</filter-name> <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class> <init-param> <param-name>casServerUrlPrefix</param-name> <param-value>https://cas.institution.edu/cas</param-value> </init-param> <init-param> <param-name>serverName</param-name> <param-value>https://jira.institution.edu/jira/</param-value> </init-param> <init-param> <param-name>redirectAfterValidation</param-name> <param-value>true</param-value> </init-param> </filter> <!--- CAS:END --> |
※ 붉은 색 볼드 형식은 추후 설정에 따라 바뀔 수 있습니다.
servlet-filter에 mapping이 되는 filter-mapping을 추가합니다.
해당 Web application의 시작 페이지가 /login.jsp라면 아래와 같이 설정을 합니다.
<!-- CAS:START - Java Client Filter Mappings --> <filter-mapping> <filter-name>CasSingleSignOutFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CasAuthenticationFilter</filter-name> <url-pattern>/login.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CasValidationFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- CAS:END --> |
Single Sign Out listener를 추가합니다.
<!-- CAS:START - Java Client Single Sign Out Listener --> <listener> <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class> </listener> <!-- CAS:END --> |
Web Application을 재 시작하여 CAS Login 페이지가 나오게 되면 정상입니다.
참고자료: http://www.ja-sig.org/wiki/display/CASC/CAS+Client+for+Java+3.1