|
1 |
| -local keycloak_keys = require("kong.plugins.jwt-keycloak.keycloak_keys") |
2 |
| -local get_issuer_keys = keycloak_keys.get_issuer_keys |
3 |
| -local get_wellknown_endpoint = keycloak_keys.get_wellknown_endpoint |
4 |
| -local get_request = keycloak_keys.get_request |
| 1 | +-- local keycloak_keys = require("kong.plugins.jwt-keycloak.keycloak_keys") |
| 2 | +-- local get_issuer_keys = keycloak_keys.get_issuer_keys |
| 3 | +-- local get_wellknown_endpoint = keycloak_keys.get_wellknown_endpoint |
| 4 | +-- local get_request = keycloak_keys.get_request |
5 | 5 |
|
6 |
| -local well_known_template = "%s/.well-known/openid-configuration" |
| 6 | +-- local well_known_template = "%s/.well-known/openid-configuration" |
7 | 7 |
|
8 |
| -describe("Keycloak key conversion", function() |
9 |
| - it("should convert the jwk to pem correctly", function() |
10 |
| - local issuer = "http://localhost:8080/auth/realms/master" |
| 8 | +-- describe("Keycloak key conversion", function() |
| 9 | +-- it("should convert the jwk to pem correctly", function() |
| 10 | +-- local issuer = "http://localhost:8080/auth/realms/master" |
11 | 11 |
|
12 |
| - res1, err1 = get_issuer_keys(get_wellknown_endpoint(well_known_template, issuer)) |
13 |
| - res2, err2 = get_request(issuer, "http") |
| 12 | +-- res1, err1 = get_issuer_keys(get_wellknown_endpoint(well_known_template, issuer)) |
| 13 | +-- res2, err2 = get_request(issuer, "http") |
14 | 14 |
|
15 |
| - assert.same(res2['public_key'], res1[1]) |
16 |
| - end) |
| 15 | +-- assert.same(res2['public_key'], res1[1]) |
| 16 | +-- end) |
17 | 17 |
|
18 |
| - it("should fail on invalid issuer", function() |
| 18 | +-- it("should fail on invalid issuer", function() |
19 | 19 |
|
20 |
| - local issuer = "http://localhost:8080/auth/realms/does_not_exist" |
| 20 | +-- local issuer = "http://localhost:8080/auth/realms/does_not_exist" |
21 | 21 |
|
22 |
| - res1, err1 = get_issuer_keys(get_wellknown_endpoint(well_known_template, issuer)) |
| 22 | +-- res1, err1 = get_issuer_keys(get_wellknown_endpoint(well_known_template, issuer)) |
23 | 23 |
|
24 |
| - assert.same(nil, res1) |
25 |
| - assert.same('Failed calling url http://localhost:8080/auth/realms/does_not_exist/.well-known/openid-configuration response status 404', err1) |
26 |
| - end) |
| 24 | +-- assert.same(nil, res1) |
| 25 | +-- assert.same('Failed calling url http://localhost:8080/auth/realms/does_not_exist/.well-known/openid-configuration response status 404', err1) |
| 26 | +-- end) |
27 | 27 |
|
28 |
| - it("should fail on bad issuer", function() |
29 |
| - local issuer = "http://localhost:8081/auth/realms/does_not_exist" |
| 28 | +-- it("should fail on bad issuer", function() |
| 29 | +-- local issuer = "http://localhost:8081/auth/realms/does_not_exist" |
30 | 30 |
|
31 |
| - res1, err1 = get_issuer_keys(get_wellknown_endpoint(well_known_template, issuer)) |
| 31 | +-- res1, err1 = get_issuer_keys(get_wellknown_endpoint(well_known_template, issuer)) |
32 | 32 |
|
33 |
| - assert.same(nil, res1) |
34 |
| - assert.same('Failed calling url http://localhost:8081/auth/realms/does_not_exist/.well-known/openid-configuration response status closed', err1) |
35 |
| - end) |
| 33 | +-- assert.same(nil, res1) |
| 34 | +-- assert.same('Failed calling url http://localhost:8081/auth/realms/does_not_exist/.well-known/openid-configuration response status closed', err1) |
| 35 | +-- end) |
36 | 36 |
|
37 |
| -end) |
| 37 | +-- end) |
0 commit comments