Skip to content

Commit aaac2fe

Browse files
The Alma sandbox url for jwts authentication needs env=sandbox (#45)
* The Alma sandbox url for jwts authentication needs env=sandbox * fixed typo in .env.sample and ordered alphabetically
1 parent cc3f622 commit aaac2fe

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

.env.sample

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FRAMEWORK_ALMA_API_URL=https://api-na.hosted.exlibrisgroup.com/almaws/v1/
1+
# If pointing to the sandbox the env=sandbox is required in the url
2+
ALMA_JWT_JWKS_URL=https://api-na.hosted.exlibrisgroup.com/auth/our institution code/jwks.json?env=sandbox
23
# Keys can be found in LastPass
34
FRAMEWORK_ALMA_API_KEY=KEY_GOES_HERE
5+
FRAMEWORK_ALMA_API_URL=https://api-na.hosted.exlibrisgroup.com/almaws/v1/
46
FRAMEWORK_ALMA_SANDBOX_KEY=KEY_GOES_HERE
5-
LIT_TIND_API_KEY=KEY_GOES_HERE
7+
LIT_TIND_API_KEY=KEY_GOES_HERE

app/controllers/concerns/alma_jwt_validator.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
require 'json'
44

55
module AlmaJwtValidator
6-
JWKS_URL = 'https://api-na.hosted.exlibrisgroup.com/auth/01UCS_BER/jwks.json'.freeze
6+
# https://developers.exlibrisgroup.com/alma/integrations/token/
7+
# If running against the Alma sandbox the JWKS_URL needs env=sandbox appended to the end of the url
8+
# e.g. https://api-na.hosted.exlibrisgroup.com/auth/01UCS_BER/jwks.json?env=sandbox.
9+
# set ALMA_JWT_JWKS_URL in your .env when running locally against the Alma sandbox
10+
JWKS_URL = ENV.fetch('ALMA_JWT_JWKS_URL', 'https://api-na.hosted.exlibrisgroup.com/auth/01UCS_BER/jwks.json').freeze
711
EXPECTED_ISS = 'Prima'.freeze
812

913
module_function

spec/controllers/concerns/alma_jwt_validator_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
describe AlmaJwtValidator do
77
let(:alma_institution_code) { '01UCS_BER' }
8-
let(:jwks_url) { "https://api-na.hosted.exlibrisgroup.com/auth/#{alma_institution_code}/jwks.json" }
8+
let(:jwks_url) { ENV.fetch('ALMA_JWT_JWKS_URL', "https://api-na.hosted.exlibrisgroup.com/auth/#{alma_institution_code}/jwks.json") }
99
let(:expected_iss) { 'Prima' }
1010

1111
# Generate an EC key pair for testing

0 commit comments

Comments
 (0)