/*
 * @(#)ResponderServlet.java
 *
 * Copyright (C) 2006 Infocity Inc. All Rights Reserved.
 */
package test.info.dragonlady.sso.servlet;

import info.dragonlady.sso.Responder;
import info.dragonlady.sso.SSOException;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * SAML応答処理サーブレット。
 * 
 * @author Hiroshi.Ebata(INFOCITY)
 * @version $Revision: 1.0 $ $Date: 2006/10/19 17:40:11 $
 */
public class ResponderServlet extends HttpServlet {

	/**
	 * コンストラクタ。
	 */
	public ResponderServlet() {
		super();
	}

	/* (非 Javadoc)
	 * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			// SAML要求に含まれるアーティファクトに対応するアサーションを取得し、SAML応答に含めて応答する
			Responder responder = new Responder(request, response);
			responder.processRequest();
		} catch(SSOException e) {
			throw new ServletException(e);
		} catch(Exception e) {
			throw new ServletException(e);
		}
	}

}
