Skip to content

Commit 1d03fea

Browse files
committed
Pass UAA JWT public key to integration sandbox components
Add a uaa_jwt_public_key helper to Sandbox that reads the RSA public key from the asymmetric uaa.yml test fixture. Wire it into the sandbox config templates so the Director (config_server.uaa and user_management.uaa) and Health Monitor receive the key and can verify token signatures, eliminating the "Decoding token without verifying" warning during integration tests.
1 parent f651d83 commit 1d03fea

4 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/spec/assets/sandbox/director_test.yml.erb

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,8 @@ user_management:
9090
uaa:
9191
symmetric_key: uaa-secret-key
9292
# public key of `uaa.jwt.policy.keys.key1.signingKey` from src/spec/assets/uaa_config/asymmetric/uaa.yml
93-
# To Generate:
94-
# openssl rsa -pubout -in <(yq .uaa.jwt.policy.keys.key1.signingKey src/spec/assets/uaa_config/asymmetric/uaa.yml)
9593
public_key: |
96-
-----BEGIN PUBLIC KEY-----
97-
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA06hlEn4/NMWtnele3C5j
98-
PZm3P55/9jppIQXF/BP0OGaAMoRNZEafv6nH1b8btc4zs0dx52Y7xmOpeRqnXDeD
99-
3E2uTW0tgjsLQU8BbjlXRrKkzvUiYZqkaCkCMxcX5OcBvhT4Km+/1u4AGuFq9sS2
100-
Pdv+IAWEOsYbJjPl3lZn2uiQCCX5P5z5JkGbQ/7mBSi/ja1SogP1MBzRLf6VyHpE
101-
q7zvVnfm+oBsvPu2RC0EM14kL/TktQwyAvpL4TWunhE7gAh4j0fMNgmBfW9NG328
102-
E2+i+1ag+WyFzSy0rJQHgV0ImEtjhmj0E0C1ysI4Fpy5gew0ZrtsFwnXcKV39xMS
103-
EG3JLzV3h+QZ4BS9nBi/G8lLF3bWO/B0WTuYDWdkLm1ng3K/Oz0KhVkVG5Igu9FD
104-
k6EkD62SsMYUMl++3/EMrtNxxvJQDSOOf59/o3BQplbl6qOG6Mpji3ZggxyRYgRS
105-
iC7PPqJAKYrP3zCzeXyQEMMYxuOcmRR3W6aY341v+9Hs4w+zNJZ2DnB+r6Jaqhpi
106-
sSiu1yzT0nzkesdv47UNLaTkt0fFMbnvkUSvtz3ZRK5MqVAgjBMULqobz5ASPPe0
107-
RBg7V6023PHtyNxsJpxsobRG2aril4+7OOspiWSHIuoV1vm1IDs2utHak0GHY0Nc
108-
MBYj/GcsUXZhHBDbjHk07IsCAwEAAQ==
109-
-----END PUBLIC KEY-----
94+
<%= uaa_jwt_public_key.strip.split("\n").map { |l| " #{l}" }.join("\n") %>
11095
url: <%= uaa_url %>
11196
<% else %>
11297
local:
@@ -156,6 +141,8 @@ config_server:
156141
client_id: <%= config_server_uaa_client_id %>
157142
client_secret: <%= config_server_uaa_client_secret %>
158143
ca_cert_path: <%= config_server_uaa_ca_cert_path %>
144+
public_key: |
145+
<%= uaa_jwt_public_key.strip.split("\n").map { |l| " #{l}" }.join("\n") %>
159146
<% end %>
160147

161148
generate_vm_passwords: <%= generate_vm_passwords %>

src/spec/assets/sandbox/health_monitor.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ director: &director
1515
client_id: hm
1616
client_secret: secret
1717
director_ca_cert: <%= certificate_path %>
18+
uaa_public_key: |
19+
<%= uaa_jwt_public_key.strip.split("\n").map { |l| " #{l}" }.join("\n") %>
1820

1921
intervals:
2022
poll_director: 5

src/spec/assets/sandbox/health_monitor_with_json_logging.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ director: &director
1515
client_id: hm
1616
client_secret: secret
1717
director_ca_cert: <%= certificate_path %>
18+
uaa_public_key: |
19+
<%= uaa_jwt_public_key.strip.split("\n").map { |l| " #{l}" }.join("\n") %>
1820

1921
intervals:
2022
poll_director: 5

src/spec/integration_support/sandbox.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,13 @@ def uaa_ca_cert_path
700700
IntegrationSupport::UaaService::ROOT_CERT
701701
end
702702

703+
def uaa_jwt_public_key
704+
@uaa_jwt_public_key ||= YAML.load_file(
705+
File.join(IntegrationSupport::Constants::BOSH_REPO_SRC_DIR,
706+
'spec', 'assets', 'uaa_config', 'asymmetric', 'uaa.yml'),
707+
).dig('uaa', 'jwt', 'policy', 'keys', 'key1', 'publicKey')
708+
end
709+
703710
attr_reader :director_tmp_path, :task_logs_dir
704711
end
705712
end

0 commit comments

Comments
 (0)