|
61 | 61 | context 'user provides director_ca_cert' do |
62 | 62 | before do |
63 | 63 | config['director_ca_cert'] = 'fake-ca-cert-path' |
| 64 | + config['uaa_public_key'] = uaa_token_public_key |
64 | 65 |
|
65 | 66 | allow(File).to receive(:exist?).with('fake-ca-cert-path').and_return(true) |
66 | 67 | allow(File).to receive(:read).with('fake-ca-cert-path').and_return('test') |
|
78 | 79 | before do |
79 | 80 | config['director_ca_cert'] = 'fake-dir-cert-path' |
80 | 81 | config['uaa_ca_cert'] = 'fake-uaa-cert-path' |
| 82 | + config['uaa_public_key'] = uaa_token_public_key |
81 | 83 |
|
82 | 84 | allow(File).to receive(:exist?).with('fake-uaa-cert-path').and_return(true) |
83 | 85 | allow(File).to receive(:read).with('fake-uaa-cert-path').and_return('uaa-pem') |
|
95 | 97 | before do |
96 | 98 | config['director_ca_cert'] = 'fake-dir-cert-path' |
97 | 99 | config['uaa_ca_cert'] = 'fake-uaa-cert-path' |
| 100 | + config['uaa_public_key'] = uaa_token_public_key |
98 | 101 |
|
99 | 102 | allow(File).to receive(:exist?).with('fake-uaa-cert-path').and_return(true) |
100 | 103 | allow(File).to receive(:read).with('fake-uaa-cert-path').and_return(" \n") |
|
114 | 117 | before do |
115 | 118 | config['director_ca_cert'] = 'fake-dir-cert-path' |
116 | 119 | config['uaa_ca_cert'] = 'fake-uaa-cert-path' |
| 120 | + config['uaa_public_key'] = uaa_token_public_key |
117 | 121 |
|
118 | 122 | allow(File).to receive(:exist?).with('fake-uaa-cert-path').and_return(false) |
119 | 123 | allow(File).to receive(:exist?).with('fake-dir-cert-path').and_return(true) |
|
132 | 136 | let(:cert_store) { instance_double(OpenSSL::X509::Store) } |
133 | 137 |
|
134 | 138 | before do |
| 139 | + config['uaa_public_key'] = uaa_token_public_key |
| 140 | + |
135 | 141 | allow(OpenSSL::X509::Store).to receive(:new).and_return(cert_store) |
136 | 142 | allow(cert_store).to receive(:set_default_paths) |
137 | 143 | allow(CF::UAA::TokenIssuer).to receive(:new).with( |
|
155 | 161 |
|
156 | 162 | context 'when uaa_public_key is not configured' do |
157 | 163 | it 'decodes UAA tokens without verifying the signature' do |
158 | | - expect(CF::UAA::TokenCoder).to receive(:decode).with(anything, { verify: false }).and_call_original |
| 164 | + expect(CF::UAA::TokenCoder).to receive(:decode) |
| 165 | + .with(anything, { verify: false }) |
| 166 | + .and_return('exp' => Time.now.to_i + 3600) |
159 | 167 | auth_provider.auth_header |
160 | 168 | end |
161 | 169 | end |
|
0 commit comments