|
6 | 6 | describe AlmaJwtValidator do |
7 | 7 | let(:alma_institution_code) { '01UCS_BER' } |
8 | 8 | let(:jwks_url) { "https://api-na.hosted.exlibrisgroup.com/auth/#{alma_institution_code}/jwks.json" } |
9 | | - let(:expected_iss) { "https://api-na.hosted.exlibrisgroup.com/auth/#{alma_institution_code}" } |
| 9 | + let(:expected_iss) { 'Prima' } |
10 | 10 |
|
11 | 11 | # Generate an RSA key pair for testing |
12 | 12 | let(:rsa_key) { OpenSSL::PKey::RSA.new(2048) } |
@@ -49,32 +49,32 @@ def generate_jwt(payload, key, kid, algorithm = 'RS256') |
49 | 49 | end |
50 | 50 |
|
51 | 51 | context 'with an invalid signature' do |
52 | | - it 'raises JWT::VerificationError' do |
| 52 | + it 'raises JWT::DecodeError' do |
53 | 53 | # Generate a token with a different key |
54 | 54 | different_key = OpenSSL::PKey::RSA.new(2048) |
55 | 55 | token = generate_jwt(test_payload, different_key, kid) |
56 | 56 |
|
57 | 57 | expect do |
58 | 58 | AlmaJwtValidator.decode_and_verify_jwt(token) |
59 | | - end.to raise_error(JWT::VerificationError) |
| 59 | + end.to raise_error(JWT::DecodeError) |
60 | 60 | end |
61 | 61 | end |
62 | 62 |
|
63 | 63 | context 'with an unknown key id' do |
64 | | - it 'raises JWT::VerificationError' do |
| 64 | + it 'raises JWT::DecodeError' do |
65 | 65 | token = generate_jwt(test_payload, rsa_key, 'unknown-kid') |
66 | 66 |
|
67 | 67 | expect do |
68 | 68 | AlmaJwtValidator.decode_and_verify_jwt(token) |
69 | | - end.to raise_error(JWT::VerificationError) |
| 69 | + end.to raise_error(JWT::DecodeError) |
70 | 70 | end |
71 | 71 | end |
72 | 72 |
|
73 | 73 | context 'with a malformed JWT' do |
74 | | - it 'raises JWT::VerificationError' do |
| 74 | + it 'raises JWT::DecodeError' do |
75 | 75 | expect do |
76 | 76 | AlmaJwtValidator.decode_and_verify_jwt('not.a.jwt') |
77 | | - end.to raise_error(JWT::VerificationError) |
| 77 | + end.to raise_error(JWT::DecodeError) |
78 | 78 | end |
79 | 79 | end |
80 | 80 |
|
|
0 commit comments