unbind-method="unregister" />\r
</reference>\r
<reference id="nodeRepository" interface="javax.jcr.Repository"\r
unbind-method="unregister" />\r
</reference>\r
<reference id="nodeRepository" interface="javax.jcr.Repository"\r
- filter="(argeo.jcr.repository.alias=node)" cardinality="0..1">\r
+ filter="(argeo.jcr.repository.alias=${org.argeo.node.repo.alias})" cardinality="0..1">\r
<listener ref="osJcrAuthenticationProvider" bind-method="register"\r
unbind-method="unregister" />\r
</reference>\r
<listener ref="osJcrAuthenticationProvider" bind-method="register"\r
unbind-method="unregister" />\r
</reference>\r
argeo.security.systemKey=argeo
argeo.security.systemKey=argeo
+org.argeo.node.repo.alias=node
package org.argeo.security.core;
package org.argeo.security.core;
-import java.security.AccessController;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
-import javax.security.auth.Subject;
-
import org.argeo.security.OsAuthenticationToken;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException;
import org.springframework.security.GrantedAuthority;
import org.springframework.security.GrantedAuthorityImpl;
import org.springframework.security.providers.AuthenticationProvider;
import org.argeo.security.OsAuthenticationToken;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException;
import org.springframework.security.GrantedAuthority;
import org.springframework.security.GrantedAuthorityImpl;
import org.springframework.security.providers.AuthenticationProvider;
-import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
/** Validates an OS authentication. */
public class OsAuthenticationProvider implements AuthenticationProvider {
/** Validates an OS authentication. */
public class OsAuthenticationProvider implements AuthenticationProvider {
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
- final OsAuthenticationToken oat;
- // if (authentication instanceof UsernamePasswordAuthenticationToken) {
- // Subject subject = Subject.getSubject(AccessController.getContext());
- // if (subject == null)
- // return null;
- // oat = new OsAuthenticationToken();
- // } else
- if (authentication instanceof OsAuthenticationToken) {
- oat = (OsAuthenticationToken) authentication;
- } else {
+ if (!(authentication instanceof OsAuthenticationToken))
- }
-
- // not OS authenticated
-// if (oat.getUser() == null)
-// return null;
List<GrantedAuthority> auths = new ArrayList<GrantedAuthority>();
auths.add(new GrantedAuthorityImpl(osUserRole));
List<GrantedAuthority> auths = new ArrayList<GrantedAuthority>();
auths.add(new GrantedAuthorityImpl(osUserRole));
this.osUserRole = osUserRole;
}
this.osUserRole = osUserRole;
}
+ public void setUserRole(String userRole) {
+ this.userRole = userRole;
+ }
+
public void setAdminRole(String adminRole) {
this.adminRole = adminRole;
}
public void setAdminRole(String adminRole) {
this.adminRole = adminRole;
}
http://www.springframework.org/schema/util\r
http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
\r
http://www.springframework.org/schema/util\r
http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
\r
<reference id="systemExecutionService" interface="org.argeo.security.SystemExecutionService" />\r
\r
<!-- SERVICES -->\r
<reference id="systemExecutionService" interface="org.argeo.security.SystemExecutionService" />\r
\r
<!-- SERVICES -->\r
private Credentials adminCredentials;
public void afterPropertiesSet() throws Exception {
private Credentials adminCredentials;
public void afterPropertiesSet() throws Exception {
+ if (repository != null) {
+ // we are just wrapping another repository
+ importNodeTypeDefinitions(repository);
+ return;
+ }
+
// remote repository
if (uri != null && !uri.trim().equals("")) {
Map<String, String> params = new HashMap<String, String>();
// remote repository
if (uri != null && !uri.trim().equals("")) {
Map<String, String> params = new HashMap<String, String>();
protected void importNodeTypeDefinitions(final Repository repository) {
final Credentials credentialsToUse;
if (systemExecutor == null) {
protected void importNodeTypeDefinitions(final Repository repository) {
final Credentials credentialsToUse;
if (systemExecutor == null) {
- if (adminCredentials == null)
- throw new ArgeoException(
- "No system executor or admin credentials found");
+ if (adminCredentials == null) {
+ log.error("No system executor or admin credentials found,"
+ + " cannot import node types");
+ return;
+ }
credentialsToUse = adminCredentials;
} else {
credentialsToUse = null;
credentialsToUse = adminCredentials;
} else {
credentialsToUse = null;
this.adminCredentials = adminCredentials;
}
this.adminCredentials = adminCredentials;
}
+ public void setRepository(Repository repository) {
+ this.repository = repository;
+ }
+