tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Broadhead <matthew.broadh...@nbmlaw.co.uk>
Subject Re: cdi execute code on session start
Date Tue, 08 May 2018 08:50:16 GMT
@WebListener works fine

public void processSessionScopedInit(@Observes 
@Initialized(SessionScoped.class) HttpSession payload) {} caused an 
infinite loop in the code.  i can send you a stack trace but it grows so 
long it is hard to find the initial cause

however i have not fixed my problem because 
KeycloakPrincipal<KeycloakSecurityContext> is not available at session 
start.  The session starts before the redirect to the login page.

is there any way to execute code just after a user signs in?  i am just 
trying to log username and ip for security purposes


On 07/05/18 18:18, Romain Manni-Bucau wrote:
> @WebListener on a HttpSessionListener?
>
> otherwise @Observes @Initialiazed(SessionScoped.class) in the cdi bean
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau>
|
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>
> 2018-05-07 17:10 GMT+02:00 Matthew Broadhead <matthew.broadhead@nbmlaw.co.uk
>> :
>> what is the best way to run code when a session is first created?  i
>> thought maybe a @PostConstruct inside a @Named @SessionScoped but it
>> doesn't trigger.
>>


Mime
View raw message