-
1. Re: Is there a way to have the repository load a Custom authentication provider programatically?
hchiorean Jun 6, 2014 5:26 AM (in response to bjconlan)We have a Spring based authentication/authorization example here: modeshape-examples/modeshape-spring-security-example at master · ModeShape/modeshape-examples · GitHub
-
2. Re: Is there a way to have the repository load a Custom authentication provider programatically?
bjconlan Jun 6, 2014 8:01 AM (in response to hchiorean)Horia! In no way was I expecting that! What magnificent solution! Thank you (and M.Sarhan) This has saved me more than a few hours (and honestly I think I never would have come to this solution which is as elegant as they come)
Thank you
-
3. Re: Is there a way to have the repository load a Custom authentication provider programatically?
bjconlan Jun 6, 2014 9:59 AM (in response to bjconlan)I just thought I would add the following comments (I don't think it warrants a pull request as most web applications these days are stateless) but If you want to make use of Horia's ModeShapeSessionFactory all you need to do is modify 1 function (and annotate the class)
...
@Component
@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)
public class ModeShapeSessionFactory implements FactoryBean<Session> {
...
and
...
@Override
public Session getObject() throws Exception {
if (session == null) {
session = repository.login(new SpringSecurityCredentials(SecurityContextHolder.getContext().getAuthentication()));
}
return session;
}
...
Now all the injected JCR Session objects should work as per usual.
-
4. Re: Is there a way to have the repository load a Custom authentication provider programatically?
hchiorean Jun 6, 2014 11:04 AM (in response to bjconlan)Thanks for update.