When trying to access a secured layer backed by an app-schema data store, or, more generally, any secured layer backed by a data store serving non-simple features, the following exception may be thrown:
Simplest solution would be to make the getDataStore method in SecuredDataStoreInfo return a DataAccess<? extends FeatureType, ? extends Feature> instead of a simple DataStore. Note that this is already the case in DecoratingDataStoreInfo, which is SecuredDataStoreInfo's parent class.
Stefano, do you wish to backport this fix? I have left this issue open until you decide.
It certainly seems suitable for backport to me
By all means, I intend to backport this to 2.8.x, and also to 2.7.x, if there are no objections. I'll submit PRs before end-of-today.
Many thanks to Ben for thoroughly testing and merging this patch!