| 
     
      
      
      From: Rob V. <rv...@do...> - 2015-06-15 09:37:13
      
     
   | 
Ash Right now you can't easily do this. Assuming you can encapsulate the logic to do the OAuth authentication and get whatever tokens you need to add in the header then the best way to do this would be to extend both SparlRemoteEndpoint and SparlRemoteUpdateEndpoint. Both of these provide a protected ApplyRequestOptions(HttpWebRequest) method (which they inherit from the common base class BaseEndpoint) that you can override and modify the HttpWebRequest as needed. Unfortunately this is currently not virtual so can't be overridden so this approach won't work right now, I've filed CORE-448 [1] to track this request The other approach you could use (but would require significantly more effort) would be to create an IStorageProvider specifically for BlazeGraph so you would have full control over the HTTP requests being made but you'd have to implement a lot from scratch which I assume is what you are trying to avoid if at all possible Rob [1] http://dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=448 From: "Noble, Ashley (AS01)" <Ash...@ho...> Reply-To: dotNetRDF User Help and Support <dot...@li...> Date: Friday, 12 June 2015 06:36 To: "dot...@li..." <dot...@li...> Subject: [dotNetRDF-Support] ReadWriteSparqlConnector OAuth authentication > Hi All, > I’m trying to use the ReadWriteSparqlConnector to connect to a BlazeGraph > store that is authenticated with OAuth (Azure Active Directory). Generally > making OAuth calls I add an Authorization header to the request, but with the > SparqlRemoteEndpoint the only thing I can set is the NetworkCredential which > can’t handle OAuth. > > Is there any suggested way to be able to add a header to the rest calls that > ReadWriteSparqlConnector makes? > > Here is a working example of what I’m doing with Basic auth, but I need to > update it to talk OAuth: > > var networkCredential = > newNetworkCredential(_rdfServerConfig.UserName, _rdfServerConfig.Password); > var endpointUri = > newUri(string.Format("{0}/bigdata/namespace/{1}/sparql", > _rdfServerConfig.RdfServer,_rdfServerConfig.DefaultDb)); > var queryEndpoint = newSparqlRemoteEndpoint(endpointUri) { > Credentials = networkCredential }; > var updateEndpoint = newSparqlRemoteUpdateEndpoint(endpointUri) { > Credentials = networkCredential }; > VDS.RDF.Options.ForceHttpBasicAuth = true; > > returnnewReadWriteSparqlConnector(queryEndpoint, updateEndpoint); > > Cheers, > Ash. > ------------------------------------------------------------------------------ > _______________________________________________ dotNetRDF-Support mailing list > dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support  |