Programming [fleXive] in Seam

You can use all the [fleXive] JSF and EJB components just like in a stand-alone application. There are, however, some issues where extra thought is required for seamless integration between both frameworks.

To use [fleXive] security features, you need to combine the Seam and [fleXive] logins. This also means that any user that should have more than guest user rights must have a valid [fleXive] account.

For example, this code requires a valid [fleXive] account for the authentication to succeed. You could also ignore the exception, which will leave guest user rights if your own authentication succeeds. In a default Seam application, Authenticator#authenticate might look like this:

public boolean authenticate() {"authenticating #0", identity.getUsername());
    //write your authentication logic here,
    //return true if the authentication was
    //successful, false otherwise
    try {
       FxContext.get().login(identity.getUsername(), identity.getPassword(), true);
    } catch (LoginException e) {
        facesMessages.add("Failed to perform [fleXive] login: " + e.getMessage());
        return false;
    return true;

To ensure that the user is logged out from [fleXive], you need to extend Seam's Identity component. For example:

@Install(precedence = Install.APPLICATION)
public class FlexiveIdentity extends RuleBasedIdentity {
    FacesMessages facesMessages;

    public void logout() {
        try {
        } catch (FxLogoutFailedException e) {
            facesMessages.add("Failed to perform [fleXive] logout: " + e.getMessage());