X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fjcr%2FRemoteJcrAuthenticationProvider.java;h=b32ba8ea9ab25d5cd49f5469e3971a2a1b9c9f2c;hb=4c1cdecd3d3de9ff6a70b875a72bfd29a85b0227;hp=a7cf268ad21227e62a1195d60c88e3a3da1b7e1f;hpb=cd50e3711d3b86921f11d9e021fc6a43bef0d400;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/RemoteJcrAuthenticationProvider.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/RemoteJcrAuthenticationProvider.java index a7cf268ad..b32ba8ea9 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/RemoteJcrAuthenticationProvider.java +++ b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/RemoteJcrAuthenticationProvider.java @@ -46,6 +46,8 @@ public class RemoteJcrAuthenticationProvider implements AuthenticationProvider, private RepositoryFactory repositoryFactory; private BundleContext bundleContext; + public final static String ROLE_REMOTE = "ROLE_REMOTE"; + public Authentication authenticate(Authentication authentication) throws AuthenticationException { NodeAuthenticationToken siteAuth = (NodeAuthenticationToken) authentication; @@ -95,17 +97,18 @@ public class RemoteJcrAuthenticationProvider implements AuthenticationProvider, } try { - Node userHome = UserJcrUtils.getUserHome(session); + // Node userHome = UserJcrUtils.getUserHome(session); // retrieve remote roles List authoritiesList = new ArrayList(); - if (userHome != null - && userHome.hasProperty(ArgeoNames.ARGEO_REMOTE_ROLES)) { - Value[] roles = userHome.getProperty( + if (userProfile != null + && userProfile.hasProperty(ArgeoNames.ARGEO_REMOTE_ROLES)) { + Value[] roles = userProfile.getProperty( ArgeoNames.ARGEO_REMOTE_ROLES).getValues(); for (int i = 0; i < roles.length; i++) authoritiesList.add(new GrantedAuthorityImpl(roles[i] .getString())); } + authoritiesList.add(new GrantedAuthorityImpl(ROLE_REMOTE)); // create authenticated objects GrantedAuthority[] authorities = authoritiesList