JCR 저장소에 연결하기 전에 로그인시 인증이 이미 발생한 Spring 어플리케이션에 Modeshape을 통합하려고합니다. 이이 작동 , 점에서 나는Modeshape AuthenticationProvider 구성
session = repository.login();
그러나이 작업 공간 레벨 액세스 제어 (문서 섹션 6.5)에 대한 내가 원하는 사용자 정의 AuthenticationProvider에 우회 것으로 보인다 사용하여 참조를 얻을 수 있습니다. 여기 내 설정이다 :
<configuration xmlns:...>
<mode:repositories>
<mode:repository jcr:name="my_repo" mode:source="my_source">
<mode:authenticationProviders>
<mode:authenticationProvider
jcr:name="customAuthProvider"
mode:classname="com.myapp.CustomSecurityContext" />
</mode:authenticationProviders>
</mode:repository>
</mode:repositories>
<mode:sources jcr:primaryType="nt:unstructured">
<mode:source jcr:name="my_source" ....
</mode:sources>
</configuration>
CustomSecurityContext는 인스턴스화되지 않습니다 (이 봄 주석이 있지만 호출되지 도착 결코 (POJO) 생성자는 어떤 아이디어가 무엇이 잘못 될 수 내가 함께 도망
@Configurable (preConstruction = true)
public class CustomSecurityContext implements SecurityContext, AuthorizationProvider {
@Autowired
private ServletCredentials servletCredentials;
@Autowired
CustomUserDetailsManager userDetailsManager;
@Autowired
WorkspaceRole workspaceRole;
private static final Logger log = LogUtil.getLogger();
public CustomSecurityContext() {
System.out.println(" ******** THIS NEVER GETS CALLED ********");
}
@Override
public String getUserName() {
HttpServletRequest request = servletCredentials.getRequest();
if (request != null) {
return request.getUserPrincipal().getName();
}
log.warn("HttpServletRequest is null, defaulting to getUserName() = null");
return null;
}
@Override
public boolean hasRole(String roleName) {
int idUser = userDetailsManager.getIdUser();
if (idUser == userDetailsManager.getSystemUserID()) {
// The system itself can work with all workspaces
return true;
}
if (roleName == null) {
log.warn("roleName is null when calling hasRole, returning false");
return false;
}
return workspaceRole.hasRole(idUser, roleName);
}
@Override
public void logout() {
log.debug("Calling logout"); // Not applicable as the session credentials are managed by Spring.
}
@Override
public boolean hasPermission(ExecutionContext context, String repositoryName, String repositorySourceName, String workspaceName, Path path, String... actions) {
log.info("Checking hasPermission for repository '" + repositoryName + "', workspace '" + workspaceName + ", path: '" + path);
if (actions != null) {
for (String action : actions) {
log.info("Action : " + action);
}
}
return true; // TODO:...
}
}
메시지를 전혀 보지 못함 - 스레드를 계속하기 위해 modeshape dicsussions로 돌리기 ... – user1016765