Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attribute to allow anonymous GET requests through Syn #9

Merged
merged 3 commits into from
May 3, 2017

Conversation

whikloj
Copy link
Member

@whikloj whikloj commented May 3, 2017

Partially resolves: Islandora/documentation#573

What does this Pull Request do?

Adds another attribute to the site element anonymous="(true|false)", to allow you to set some or all sites to allow unauthenticated GET requests.

What's new?

This does not clean up the XML validation issues I expressed here, but I figured those could be dealt with later.

This adds in the third parsing of the XML files to generate a map of URL and anonymous check, if a site URL matches the host that is the option used, or if the default is set and no site is specified that is what is used.

Sets credentials as anonymous with roles of anonymous and islandora.

Not sure if there is a way to avoid authentication once you have required it, like to avoid creating sessions like @jonathangreen was suggesting. That can come later.

How should this be tested?

  1. Pull this branch into your claw_vagrant
  2. Run ./gradlew clean build
  3. Copy the build/lib/islandora-syn-0.0.1-all.jar to /var/lib/tomcat8/lib
  4. Edit your /var/lib/tomcat8/conf/syn-settings.xml sites file include an anonymous='true' option.
  5. Restart tomcat

You should be able to access http://localhost:8080/fcrepo/rest without a token, but a POST request will still fail.

Interested parties

@jonathangreen @ajs6f @dannylamb

@codecov
Copy link

codecov bot commented May 3, 2017

Codecov Report

Merging #9 into master will increase coverage by 5.18%.
The diff coverage is 90.47%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master       #9      +/-   ##
============================================
+ Coverage     80.93%   86.11%   +5.18%     
- Complexity       97      116      +19     
============================================
  Files             6        6              
  Lines           320      353      +33     
  Branches         62       65       +3     
============================================
+ Hits            259      304      +45     
+ Misses           33       24       -9     
+ Partials         28       25       -3
Impacted Files Coverage Δ Complexity Δ
src/main/java/ca/islandora/syn/settings/Site.java 100% <100%> (ø) 15 <2> (+2) ⬆️
...java/ca/islandora/syn/settings/SettingsParser.java 81.93% <72.72%> (+6.43%) 50 <6> (+9) ⬆️
src/main/java/ca/islandora/syn/valve/SynValve.java 90.74% <96.29%> (+6.4%) 28 <9> (+8) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb6a59d...23ae92c. Read the comment docs.

@whikloj
Copy link
Member Author

whikloj commented May 3, 2017

I just realized that this should cover HEAD requests too. I'll add that

Clean up allow anonymous checks
@dannylamb
Copy link
Contributor

Testing now...

@dannylamb
Copy link
Contributor

Works as expected.

@dannylamb dannylamb merged commit 0924304 into Islandora:master May 3, 2017
@dannylamb
Copy link
Contributor

@whikloj++ Adding another issue to update syn-settings.xml in claw_vagrant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow read only web access to fcrepo
2 participants