Skip to content

Commit

Permalink
Update Alpaca to use new JWT Authenication (#30)
Browse files Browse the repository at this point in the history
* Update Alpaca to use new JWT Authenication

Remove the old hardcoded drupal username and password and instead rely
on the JWT token passed in the message to provide drupal authentication.

* Checking that we pass along the authentication header (#1)
  • Loading branch information
jonathangreen authored and ruebot committed Mar 8, 2017
1 parent 921732f commit 5cd05d8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ input.stream=activemq:queue:islandora-indexing-triplestore

# The base URL of the triplestore being used.
triplestore.baseUrl=http://localhost:8080/bigdata/namespace/kb/sparql

# Credentials for user with read privileges for the resource.
drupal.username=
drupal.password=
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ public void configure() {
from("direct:retrieve.resource")
.routeId("IslandoraTriplestoreIndexerRetrieveResource")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.toD("${property.uri}?_format=jsonld&authUsername={{drupal.username}}" +
"&authPassword={{drupal.password}}"
);
.setHeader("Authentication", simple("${headers['Authentication']}"))
.toD("${property.uri}?_format=jsonld");

// Converts the resource to a SPARQL update query, POSTing it to the triplestore.
from("direct:triplestore.index")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
<cm:property name="error.maxRedeliveries" value="5"/>
<cm:property name="input.stream" value="activemq:queue:islandora-indexing-triplestore"/>
<cm:property name="triplestore.baseUrl" value="http://localhost:8080/bigdata/namespace/kb/sparql"/>
<cm:property name="drupal.username" value=""/>
<cm:property name="drupal.password" value=""/>
</cm:default-properties>
</cm:property-placeholder>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ public void configure() throws Exception {

endpoint.expectedMessageCount(1);
endpoint.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
endpoint.expectedHeaderReceived("Authentication", "some_nifty_token");

template.send(exchange -> {
exchange.setProperty("uri", "http://localhost:8000/fedora_resource/1");
exchange.getIn().setHeader("Authentication", "some_nifty_token");
});

assertMockEndpointsSatisfied();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
<cm:property name="error.maxRedeliveries" value="5"/>
<cm:property name="input.stream" value="activemq:queue:islandora-indexing-triplestore"/>
<cm:property name="triplestore.baseUrl" value="http://localhost:8080/bigdata/namespace/kb/sparql"/>
<cm:property name="drupal.username" value=""/>
<cm:property name="drupal.password" value=""/>
<cm:property name="jms.brokerUrl" value="tcp://localhost:61616"/>
</cm:default-properties>
</cm:property-placeholder>
Expand Down

0 comments on commit 5cd05d8

Please sign in to comment.