REST login does not propagate to JSF by default?
sachindole Aug 19, 2014 10:45 AMI have the BasicModel working for me and can authenticate users using a rest end point that is called via ajax from an HTML5 app. however, after having logged the user in, the EL #{identity.loggedIn} returns false. If I call a different REST @Stateless endpoint that is @Secured using a custom authorizer of @SecurityBindingType, I do get an identity passed in to the authorizer, but, here too, identity.getAccount returns null (isLoggedIn false). If I call the initial endpoint that i used to login again, here, identity is correctly setup and isLoggedIn returns true and getAccount returns the right account.
My environment is wildfly 8.1.0 with picketlink 2.6.0 (not the 2.5.2)
I must have missed some configuration. Here is my @ApplicationScoped config initialization class. What should I be doing in order to have the rest authentication to propagate to all layers?
THANK YOU!
@ApplicationScoped public class PicketLinkConfiguration { @Inject private EEJPAContextInitializer eejpaContextInitializer; @Produces @PicketLink @PersistenceContext(unitName = "trelair") private EntityManager entityManager; @Produces @PicketLink public Partition createPartition() { return partitionManager.getPartition(Realm.class, "trelair"); } @Inject private PartitionManager partitionManager; @Produces public IdentityConfiguration produceJPAConfiguration() { IdentityConfigurationBuilder builder = new IdentityConfigurationBuilder(); builder .named("default") .stores() .jpa() .mappedEntity(AccountTypeEntity.class, RoleTypeEntity.class, GroupTypeEntity.class, IdentityTypeEntity.class, RelationshipTypeEntity.class, RelationshipIdentityTypeEntity.class, PartitionTypeEntity.class, PasswordCredentialTypeEntity.class, OTPCredentialTypeEntity.class, AttributeTypeEntity.class, PermissionsEntity.class) .supportAllFeatures() .addContextInitializer(eejpaContextInitializer); // configure the JPA store return builder.build(); } public void observeIdentityConfigurationEvent(@Observes IdentityConfigurationEvent event) { IdentityConfigurationBuilder builder = event.getConfig(); // use the builder to provide your own configuration } public void init(@Observes PartitionManagerCreateEvent event) { // retrieve the recently created partition manager instance PartitionManager partitionManager = event.getPartitionManager(); // retrieve all the configuration used to build the instance Collection configurations = partitionManager.getConfigurations(); } }