Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(80)

Unified Diff: src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java

Issue 12523046: basic forms authentication support for crawling (Closed)
Patch Set: with code review comments Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java b/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
index e90f1dd07bfc3effad5c0471f2122c6ad0d84d56..9121dbb82a4de357d93ca24b29df82d61c027fb1 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
@@ -12,7 +12,7 @@ import com.google.enterprise.adaptor.GroupPrincipal;
import com.google.enterprise.adaptor.PollingIncrementalAdaptor;
import com.google.enterprise.adaptor.Request;
import com.google.enterprise.adaptor.Response;
-import com.microsoft.schemas.sharepoint.soap.Authentication.AuthenticationSoap;
+import com.microsoft.schemas.sharepoint.soap.authentication.AuthenticationSoap;
import com.microsoft.webservices.sharepointportalserver.userprofilechangeservice.ArrayOfUserProfileChangeData;
import com.microsoft.webservices.sharepointportalserver.userprofilechangeservice.UserProfileChangeData;
@@ -122,7 +122,6 @@ public class SharePointUserProfileAdaptor extends AbstractAdaptor
private static final Logger log =
Logger.getLogger(SharePointUserProfileAdaptor.class.getName());
- private static FormsAuthenticationHandler authenticationHandler;
private String virtualServer;
private NtlmAuthenticator ntlmAuthenticator;
private final UserProfileServiceFactory userProfileServiceFactory;
@@ -191,8 +190,8 @@ public class SharePointUserProfileAdaptor extends AbstractAdaptor
Authenticator.setDefault(ntlmAuthenticator);
String authenticationEndPoint
= virtualServer + "/_vti_bin/Authentication.asmx";
- authenticationHandler = new FormsAuthenticationHandler(virtualServer,
- username, password, scheduledExecutor,
+ FormsAuthenticationHandler authenticationHandler
+ = new FormsAuthenticationHandler(username, password, scheduledExecutor,
userProfileServiceFactory.newAuthentication(authenticationEndPoint));
authenticationHandler.start();
log.log(Level.FINEST, "Initializing User profile Service Client for {0}",
@@ -200,7 +199,8 @@ public class SharePointUserProfileAdaptor extends AbstractAdaptor
userProfileServiceClient = new UserProfileServiceClient(
userProfileServiceFactory.newUserProfileService(
virtualServer + USER_PROFILE_SERVICE_ENDPOINT,
- virtualServer + USER_PROFILE_CHANGE_SERVICE_ENDPOINT));
+ virtualServer + USER_PROFILE_CHANGE_SERVICE_ENDPOINT,
+ authenticationHandler.getAuthenticationCookies()));
userProfileChangeToken =
userProfileServiceClient.userProfileServiceWS.getCurrentChangeToken();
}
@@ -257,7 +257,7 @@ public class SharePointUserProfileAdaptor extends AbstractAdaptor
@VisibleForTesting
interface UserProfileServiceFactory {
public UserProfileServiceWS newUserProfileService(String endpoint,
- String endpointChangeService);
+ String endpointChangeService, List<String> cookies);
public AuthenticationSoap newAuthentication(String endpoint);
}
@@ -287,15 +287,16 @@ public class SharePointUserProfileAdaptor extends AbstractAdaptor
@Override
public UserProfileServiceWS newUserProfileService(String endpoint,
- String endpointChangeService) {
+ String endpointChangeService, List<String> cookies) {
EndpointReference endpointRef = new W3CEndpointReferenceBuilder()
.address(endpoint).build();
EndpointReference endpointChangeRef = new W3CEndpointReferenceBuilder()
.address(endpointChangeService).build();
- if (authenticationHandler.isFormsAuthentication()) {
- addFormsAuthenticationCookies((BindingProvider) userProfileServiceSoap);
+ if (!cookies.isEmpty()) {
ejona 2013/08/17 21:57:58 Similar comment as elsewhere.
addFormsAuthenticationCookies(
- (BindingProvider) userProfileChangeServiceSoap);
+ (BindingProvider) userProfileServiceSoap, cookies);
+ addFormsAuthenticationCookies(
+ (BindingProvider) userProfileChangeServiceSoap, cookies);
ejona 2013/08/17 21:57:58 Indent two more.
}
return new SharePointUserProfileServiceWS(userProfileServiceSoap.
getPort(endpointRef, UserProfileServiceSoap.class),
@@ -303,10 +304,10 @@ public class SharePointUserProfileAdaptor extends AbstractAdaptor
UserProfileChangeServiceSoap.class));
}
- private void addFormsAuthenticationCookies(BindingProvider port) {
+ private void addFormsAuthenticationCookies(BindingProvider port,
+ List<String> cookies) {
port.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS,
- Collections.singletonMap("Cookie",
- authenticationHandler.getAuthenticationCookies()));
+ Collections.singletonMap("Cookie", cookies));
}
@Override

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b