Skip to content

Commit

Permalink
Correctly publish OIDC redirectUris to Manage
Browse files Browse the repository at this point in the history
The array that is passed along to manage should be a list, not a map.
If the php indexes are updated along the way, by adding/removing items
from the form. The index order might not be sequentially pristine. This
causes JSON encode to generate a map instead of a list.

By resetting the list before publishing, this problem should be remedied

https://www.pivotaltracker.com/story/show/163646662
  • Loading branch information
MKodde committed Feb 4, 2019
1 parent 0bc3a51 commit d883127
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Next release

**Bugfix**
- Correctly publish OIDC redirect URIs to Manage #233

## 2.0.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ private function generateOidcClient(Entity $entity)
{
$metadata['clientId'] = str_replace('://', '@//', $entity->getEntityId());
$metadata['clientSecret'] = $entity->getClientSecret();
$metadata['redirectUris'] = $entity->getRedirectUris();
// Reset the redirect URI list in order to get a correct JSON formatting (See #163646662)
$metadata['redirectUris'] = array_values($entity->getRedirectUris());
$metadata['grantType'] = $entity->getGrantType()->getGrantType();
$metadata['scope'] = ['openid'];

Expand Down
12 changes: 6 additions & 6 deletions tests/unit/Application/Metadata/JsonGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,10 @@ public function test_it_can_build_oidc_entity_data_for_new_entities()
'clientSecret' => 'test',
'redirectUris' =>
array (
0 => 'uri1',
1 => 'uri2',
2 => 'uri3',
3 => 'http://playground-test',
'uri1',
'uri2',
'uri3',
'http://playground-test',
),
'grantType' => 'implicit',
'scope' =>
Expand Down Expand Up @@ -537,8 +537,8 @@ public function test_it_can_build_oidc_data_for_existing_entities()
'redirectUris' =>
array (
0 => 'uri1',
1 => 'uri2',
2 => 'uri3',
8 => 'uri2',
4 => 'uri3',
3 => 'http://playground-test',
),
'grantType' => 'implicit',
Expand Down

0 comments on commit d883127

Please sign in to comment.