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 de21f43 commit 771ced8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Next release

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

**Improvement**
- Provide a custom service overview for admin #234

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

/**
Expand Down
10 changes: 5 additions & 5 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 @@ -628,7 +628,7 @@ private function createOidcEntity()
$entity->setOrganizationUrlNl('http://orgnl');

$entity->setClientSecret('test');
$entity->setRedirectUris(['uri1','uri2', 'uri3']);
$entity->setRedirectUris([0 => 'uri1', 2 => 'uri2', 8 => 'uri3']);
$entity->setGrantType(new OidcGrantType('implicit'));
$entity->setEnablePlayground(true);

Expand Down

0 comments on commit 771ced8

Please sign in to comment.