jklee
jklee

Reputation: 2268

How use @Ressource SessionContext right?

I need a bean for inject @Ressource SessionContext ctx with JAAS. With the SessionContext can I check the user rights about ctx.isCallerInRole("ROLE");

But what is the right Bean declaration? @Statful? @Stateless? and @SessionScope? I need a instance for every User.

Upvotes: 0

Views: 788

Answers (1)

Szarpul
Szarpul

Reputation: 1571

With the SessionContext can I check the user rights about ctx.isCallerInRole("ROLE")?

Yes you can.

But what is the right Bean declaration? @Statful? @Stateless? and @SessionScope?

There is no @SessionScope for EJB. You can inject SessionContext both in @Statful/@Stateless bean. It depends on what you need. Usually User instance has to live as long as the session lives. EJB doesn't have session-scoped beans, so for that purpes it is often mixed with CDI (read more here CDI + EJB) or other session-scoped beans like Managed beans.

Upvotes: 1

Related Questions