如何自定义seam 3凭证?

时间:2011-07-20 13:06:42

标签: cdi seam3

有没有办法自定义seam 3凭证对象?

我需要为凭证添加一个属性(验证码)。我尝试了以下代码:

@Named("credentials") @SessionScoped
public class Credentials extends CredentialsImpl {

    private static final long serialVersionUID = -4377742708407292709L;

    private String captcha;

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
         this.captcha = captcha;
    }

}

但它与org.jboss.seam.security.CredentialsImpl @Named注释有冲突。我如何覆盖凭证?

1 个答案:

答案 0 :(得分:0)

你可以试试CDI specialization。即:

@Alternative 
@Specializes 
@SessionScoped
public class Credentials extends CredentialsImpl {

    private static final long serialVersionUID = -4377742708407292709L;

    private String captcha;

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
         this.captcha = captcha;
    }

}