[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openejb-user
Subject:    Re: cdi execute code on session start
From:       Romain Manni-Bucau <rmannibucau () gmail ! com>
Date:       2018-05-08 9:34:40
Message-ID: CACLE=7PwFa0Ssjd7BVSyhSvyg3M44dOs+dYBBmY7p6Jz9nKa1g () mail ! gmail ! com
[Download RAW message or body]


Le mar. 8 mai 2018 10:50, Matthew Broadhead <matthew.broadhead@nbmlaw.co.uk=
>
a =C3=A9crit :

> @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
>


Put a breakpoint ;)

>
> 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
>

Depends your login mecanism, maybe have a look on keycloak side



>
> 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-performan=
ce
> >
> >
> > 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.
> >>
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic