/* ================================================================== * 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.context.Context; /** * <p> PasswordPassport.java </p> * <p> * 账号密码通行证:从Context.getRequestContext()获取用户的登陆帐号和密码。 * * 通行证需要经过验证通过再正式发放IdentityCard(身份证书)。 * </p> */ public class PasswordPassport { /** * 用户登录名 */ private String loginName; /** * 用户密码 */ private String password; /** * 默认构造函数 */ public PasswordPassport() throws UserIdentificationException { this.loginName = Context.getRequestContext().getValueFromHeaderOrParameter(SSOConstants.LOGINNAME_IN_SESSION); this.password = Context.getRequestContext().getValueFromHeaderOrParameter(SSOConstants.USER_PASSWORD); if (loginName == null) { throw new UserIdentificationException("登录名不能为空,请重新登录"); } if (password == null) { throw new UserIdentificationException("密码不能为空,请重新登录"); } } public String getPassword() { return password; } public String getLoginName() { return loginName; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("\n----------- Passport --------------"); sb.append("\nClassName: ").append(this.getClass().getName()); sb.append("\nUserName: ").append(this.loginName); sb.append("\nPassword: ").append(this.password); sb.append("\n------------- End -----------------"); return sb.toString(); } }