[jboss-user] [JBoss Seam] - External Client and Seam Security

agnadello do-not-reply at jboss.com
Mon Nov 26 17:54:36 EST 2007


Hi,

I've configured Seam to use drools in my security setup according to Seam docs, chapter 13. Everything works fine...

I also have a QuartzInitializerServlet starting up jobs (POJO's):

public void execute(final JobExecutionContext theJobExecutionContext)
  | 			throws JobExecutionException {
  | 		this.LOGGER.info("Executing job with description: "
  | 				+ theJobExecutionContext.getJobDetail().getDescription());
  | 
  | 		try {
  | 			UsernamePasswordHandler handler = new UsernamePasswordHandler(
  | 					"user", "Demo987!");
  | 			this.LOGGER.info("Login attempt...");
  | 			LoginContext lc = new LoginContext("client-login", handler);
  | 			lc.login();
  | 			this.LOGGER.info("Login successful!");
  | 			// Any calls to secured resources now use the username/password
  | 			// identity
  | 			final EchoService service = (EchoService) new InitialContext()
  | 					.lookup("sio/EchoServiceBean/local");
  | 			final Echo echo = service.echo();
  | 			this.LOGGER.info("Echo Message = '" + echo + "'");
  | 			// Clear and restore the previous identity
  | 			this.LOGGER.info("Logout attempt...");
  | 			lc.logout();
  | 			this.LOGGER.info("Logout successful!");
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 		}
  | 	}

The EJB method 'echo' is annotated with the Seam @Restrict annotation like this:

@Restrict("#{s:hasRole('admin')}")

My question is if it's possible to make the external JAAS login (from the Quartz job) to propagate to the Seam security framework?

The described implementation doesn't work and throws IllegalStateException with the message that there is no active session context.

Anyone done this before?

Seam 2.0.0.GA and JBoss AS 4.2.1.GA

Cheers!

Regards, Andreas

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107898#4107898

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107898



More information about the jboss-user mailing list