- public Authentication authenticate(Authentication authentication)
- throws AuthenticationException {
- final OsAuthenticationToken authen = (OsAuthenticationToken) super
- .authenticate(authentication);
- systemExecutor.execute(new Runnable() {
- public void run() {
- try {
- Session session = JcrUtils.getRepositoryByAlias(
- repositoryFactory, repositoryAlias)
- .login(workspace);
- Node userHome = JcrUtils.getUserHome(session,
- authen.getName());
- if (userHome == null)
- JcrUtils.createUserHome(session, homeBasePath,
- authen.getName());
- authen.setDetails(getUserDetails(userHome, authen));
- } catch (RepositoryException e) {
- throw new ArgeoException(
- "Unexpected exception when synchronizing OS and JCR security ",
- e);
- }
- }
- });
- return authen;
- }
-
- /** Builds user details based on the authentication and the user home. */
- protected UserDetails getUserDetails(Node userHome, Authentication authen) {