public class DeltaSpikeUserProvider implements UserProvider {
@Override
public FeatureUser getCurrentUser() {
Identity identity = BeanProvider.getContextualReference(Identity.class);
if (identity == null) {
throw new IllegalStateException("Could not obtain Identity");
}
if (identity.isLoggedIn()) {
String name = identity.getUser().getId();
return new SimpleFeatureUser(name, isFeatureAdmin(identity));
}
return null;
}