samvera / hyku

Hyku: A multi-tenant Hyrax application built on the latest and greatest Samvera community components. Brought to you by the Hydra-in-a-Box project partners and IMLS; maintained by the Hyku Interest Group.
https://samvera.atlassian.net/wiki/spaces/hyku/overview
Other
94 stars 46 forks source link

🎁 Add Api-Key auth for WillowSword #2229

Closed kirkkwang closed 1 month ago

kirkkwang commented 1 month ago

This commit will add the api_key column to the user model and turn on authorized requests for WillowSword. To give a user access, do something like the following:

u = User.find_by(email: 'some_user@example.com')
u.api_key = SecureRandom.uuid
u.save!

To add it in the header, it should look like this:

curl --request GET \
  --url http://dev.hyku.test/sword/service_document \
  --header 'Content-Type: application/xml' \
  --header 'Api-key: some-api-key'

Ref: