package kcg.faics.encode;

import static org.junit.Assert.*;

import javax.annotation.Resource;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

/**
 * @author kimnomin
 *
 * SHA 인코더 테스트.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = { "classpath:/spring/context-*.xml" })
public class SHAEncoderTest {
	
	/**
	 * 인코더.
	 */
	@Resource(name = "passwordEncoder")
	private ShaPasswordEncoder pwEncoder;
	
	/**
	 * 테스트 대상 비밀번호.
	 */
	private String pw = "rhksflwk!!";
	
	/**
	 * 암호화된 비밀번호.
	 */
	private String hashedPw = "be2242ab24405329c409d382897c641854bd768001cfb50606858049b1a48133";
	
	/**
	 * Encoding Test.
	 */
	@Test
	@Ignore
	public void encTest() {
		String hashedPw = pwEncoder.encodePassword(pw, null);
	}
	
	/**
	 * Match Test.
	 */
	@Test
	public void matchTest() {
		boolean isValid = pwEncoder.isPasswordValid(hashedPw, pw, null);
	}

}
