/* ==================================================================
* Created [2009-4-27 下午11:32:55] by Jon.King
* ==================================================================
* TSS
* ==================================================================
* mailTo:jinpujun@hotmail.com
* Copyright (c) Jon.King, 2009-2012
* ==================================================================
*/
package com.jinhe.tss.core.sso;
import com.jinhe.tss.core.exception.UserIdentificationException;
import com.jinhe.tss.core.sso.IOperator;
import com.jinhe.tss.core.sso.PasswordPassport;
import com.jinhe.tss.core.sso.identifier.BaseUserIdentifier;
/**
* <p> DemoUserIdentifier.java </p>
* <p>
* 虚拟身份认证器:校验用户名和密码
* </p>
*/
public class DemoUserIdentifier extends BaseUserIdentifier {
protected IOperator validate() throws UserIdentificationException {
DemoPWDOperator operator = new DemoPWDOperator(1L);
PasswordPassport passport = new PasswordPassport();
if(passport.getLoginName().equals(operator.getLoginName()) &&
passport.getPassword().equals(operator.getPassword()) ) {
log.debug("用户:" + passport.getLoginName() + " 密码验证成功!");
return operator;
}
throw new UserIdentificationException("用户/密码不正确,请重新登录");
}
}