Announcement Announcement Module
No announcement yet.
spring quartz job - accessing spring-security secured bean methods Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring quartz job - accessing spring-security secured bean methods

    I added cronjobs to spring app using quartz.

    inside these jobs, I would like to access spring-security secured bean methods from another app.

    This is my application structure.

    | - core
    | - webapp
    | - jobs-app

    both the webapp and jobsapp use core services. jobsapp is not a web application. It just has quartz jobs in it.

    Inside a job if I try to access a bean that is secured using SpringSecurity global-method-security I get an exception `{ ntialsNotFoundException}"org.springframework.secur ity.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext"`

    If I set the context using SecurityContextHolder.getContext().setAuthenticati on to a power user, it works.

    But, I have to do this for all the jobs.

    Is there a way I can make all the jobs runas a particular user? may be some configuration somewhere?