In my custom authentication provider, I was able to get the domain object through my Service API, but when I crawled from one domain object to another to get certain value to perform additional checks, Spring complains the Hibernate session doesn't exist:-
domain.getAnotherDomain().getProperty(); // epic FAIL
I have the following AOP transaction to wrap all my project APIs with transaction, and I'm pretty sure my custom authentication provider falls into the following pattern:-
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor pointcut="execution(* my.project..*.*(..))" advice-ref="txAdvice" />
</aop:config>
I also have OpenSessionInView filter configured, but I don't think that applies to Spring Security anyway.
I guess I can create a specific Service API to perform all the required checks, but I'm curious why I'm not able to wrap my custom authentication provider with a proper transaction.
Any explanation? Thanks.