public override void Initialize([NotNull] HttpWebClientProtocol service, [NotNull] SpContextBase context) { Assert.ArgumentNotNull(service, "service"); Assert.ArgumentNotNull(context, "context"); if (string.IsNullOrEmpty(((NetworkCredential)context.Credentials).UserName)) { string message = "Claims-based authentication requires username"; if (context.Credentials == CredentialCache.DefaultNetworkCredentials) { message = "Default credentials isn't applicable for claims-based authentication"; } throw new Exception(message); } var credential = (NetworkCredential)context.Credentials; var cookies = this.cache.GetUnexpired(context.Url, credential); if (cookies == null) { cookies = this.claimsBasedWorkflow.GetAuthenticationCookies(context.Url, credential); this.cache.Add(context.Url, credential, cookies, DateTime.Now.Add(this.CookiesExpirationInterval)); } service.CookieContainer = cookies; }
public override void Initialize([NotNull] HttpWebClientProtocol service, [NotNull] SpContextBase context) { Assert.ArgumentNotNull(service, "service"); Assert.ArgumentNotNull(context, "context"); service.Credentials = context.Credentials; service.PreAuthenticate = true; }
public BaseConnectionConfiguration CreateInstance([NotNull] SpContextBase context) { Assert.ArgumentNotNull(context, "context"); string configuration = context.ConnectionConfiguration; if (string.IsNullOrEmpty(configuration)) { configuration = "Default"; } var connectionConfiguration = string.Format("/sitecore/sharepoint/connectionConfigurations/{0}", configuration); return((BaseConnectionConfiguration)this.sitecoreFactory.CreateObject(connectionConfiguration, true)); }
public ConnectionConfigurationsFactoryTests() { this.context = Substitute.For <SpContextBase>(); this.sitecoreFactory = Substitute.For <SitecoreFactory>(); this.factory = new ConnectionConfigurationsFactory(this.sitecoreFactory); }
/// <summary> /// Sets the url of the target Web service. /// </summary> /// <param name="service">The target Web service.</param> /// <param name="url">The specified url.</param> /// <param name="context"> The context of the SharePoint server.</param> public static void SetServer(this Data.WebServices.SharepointCopy.Copy service, Uri url, SpContextBase context = null) { SetUpService(service, url, "/_vti_bin/copy.asmx", context); }
/// <summary> /// Sets the url of the target Web service. /// </summary> /// <param name="service">The target Web service.</param> /// <param name="url">The specified url.</param> /// <param name="context"> The context of the SharePoint server.</param> public static void SetServer(this Data.WebServices.SharepointMOSSSearch.QueryService service, Uri url, SpContextBase context = null) { SetUpService(service, url, "/_vti_bin/search.asmx", context); }
/// <summary> /// Sets the url of the target Web service. /// </summary> /// <param name="service">The target Web service.</param> /// <param name="url">The specified url.</param> /// <param name="context"> The context of the SharePoint server.</param> public static void SetServer(this Lists service, Uri url, SpContextBase context = null) { SetUpService(service, url, "/_vti_bin/lists.asmx", context); }
/// <summary> /// Sets the url of the target Web service. /// </summary> /// <param name="service"> /// The service. /// </param> /// <param name="server"> /// The server. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="context"> The context of the SharePoint server.</param> private static void SetUpService(HttpWebClientProtocol service, Uri server, string name, SpContextBase context) { service.Url = StringUtil.RemovePostfix('/', server.ToString()) + name; var init = ConnectionConfigurationsFactory.CreateInstance(context); init.Initialize(service, context); }
public abstract void Initialize(HttpWebClientProtocol service, SpContextBase context);