This content has been marked as final.
Show 1 reply
-
1. Re: Can I Override Seam's Credentials Component?
karypid Aug 23, 2009 11:30 AM (in response to zhangxiubo)Yes you can. The approach is similar to overriding Identity itself (as described HERE.
Basically you would do something like:
@Name("org.jboss.seam.security.credentials") @Scope(SESSION) @Install(precedence = APPLICATION) @BypassInterceptors public class UserCredentials extends Credentials { private String domain; public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain; if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED); } }
Then in your AuthenticatorBean:
@Stateless @Name("authenticator") public class AuthenticatorBean implements Authenticator { @Logger private Log log; @In Identity identity; @In UserCredentials credentials; public boolean authenticate() { log.info("authenticating {0} [ institution: {1} ]", credentials .getUsername(), credentials.getDomain()); ...