Skip to content

Commit 1fea71c

Browse files
committed
Rename entitlements to attributes
1 parent c074df4 commit 1fea71c

File tree

13 files changed

+52
-52
lines changed

13 files changed

+52
-52
lines changed

library/EngineBlock/Corto/Module/Service/SRAMInterrupt.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use OpenConext\EngineBlock\Service\AuthenticationStateHelperInterface;
2020
use OpenConext\EngineBlock\Service\ProcessingStateHelperInterface;
2121
use OpenConext\EngineBlock\Stepup\StepupGatewayCallOutHelper;
22-
use OpenConext\EngineBlockBundle\Sbs\Dto\EntitlementsRequest;
22+
use OpenConext\EngineBlockBundle\Sbs\Dto\AttributesRequest;
2323
use OpenConext\EngineBlockBundle\Sbs\SbsAttributeMerger;
2424
use Symfony\Component\HttpFoundation\Request;
2525

@@ -93,8 +93,8 @@ public function serve($serviceName, Request $httpRequest)
9393
$attributes = $receivedResponse->getAssertion()->getAttributes();
9494
$nonce = $receivedResponse->getSRAMInterruptNonce();
9595

96-
$request = EntitlementsRequest::create($nonce);
97-
$interruptResponse = $this->getSbsClient()->requestEntitlementsFor($request);
96+
$request = AttributesRequest::create($nonce);
97+
$interruptResponse = $this->getSbsClient()->requestAttributesFor($request);
9898

9999
if (!empty($interruptResponse->attributes)) {
100100
$attributes = $this->_sbsAttributeMerger->mergeAttributes($attributes, $interruptResponse->attributes);

src/OpenConext/EngineBlockBundle/Sbs/EntitlementsResponse.php renamed to src/OpenConext/EngineBlockBundle/Sbs/AttributesResponse.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020

2121
use OpenConext\EngineBlockBundle\Exception\InvalidSbsResponseException;
2222

23-
class EntitlementsResponse
23+
class AttributesResponse
2424
{
2525
/**
2626
* @var array
2727
*/
2828
public $attributes;
2929

30-
public static function fromData(array $jsonData) : EntitlementsResponse
30+
public static function fromData(array $jsonData) : AttributesResponse
3131
{
3232
if (!isset($jsonData['attributes'])) {
33-
throw new InvalidSbsResponseException('Key: Attributes was not found in the SBS entitlements response');
33+
throw new InvalidSbsResponseException('Key: Attributes was not found in the SBS attributes response');
3434
}
3535
if (!is_array($jsonData['attributes'])) {
36-
throw new InvalidSbsResponseException('Key: Attributes was not found in the SBS entitlements response');
36+
throw new InvalidSbsResponseException('Key: Attributes was not an array in the SBS attributes response');
3737
}
3838

3939
$response = new self;

src/OpenConext/EngineBlockBundle/Sbs/Dto/EntitlementsRequest.php renamed to src/OpenConext/EngineBlockBundle/Sbs/Dto/AttributesRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use JsonSerializable;
2222
use OpenConext\EngineBlock\Assert\Assertion;
2323

24-
class EntitlementsRequest implements JsonSerializable
24+
class AttributesRequest implements JsonSerializable
2525
{
2626
/**
2727
* @var string
@@ -30,7 +30,7 @@ class EntitlementsRequest implements JsonSerializable
3030

3131
public static function create(
3232
string $nonce
33-
) : EntitlementsRequest {
33+
) : AttributesRequest {
3434
Assertion::string($nonce, 'The nonce must be a string.');
3535

3636
$request = new self();

src/OpenConext/EngineBlockBundle/Sbs/SbsClient.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
use OpenConext\EngineBlock\Http\HttpClient;
2222
use OpenConext\EngineBlockBundle\Exception\InvalidSbsResponseException;
23-
use OpenConext\EngineBlockBundle\Sbs\Dto\EntitlementsRequest;
23+
use OpenConext\EngineBlockBundle\Sbs\Dto\AttributesRequest;
2424
use OpenConext\EngineBlockBundle\Sbs\Dto\AuthzRequest;
2525

2626
final class SbsClient implements SbsClientInterface
@@ -96,8 +96,8 @@ public function authz(AuthzRequest $request): AuthzResponse
9696
return AuthzResponse::fromData($jsonData);
9797
}
9898

99-
// Entitlements use authzLocation !!
100-
public function requestEntitlementsFor(EntitlementsRequest $request): EntitlementsResponse
99+
// Attributes use authzLocation !!
100+
public function requestAttributesFor(AttributesRequest $request): AttributesResponse
101101
{
102102
$jsonData = $this->httpClient->post(
103103
json_encode($request),
@@ -111,7 +111,7 @@ public function requestEntitlementsFor(EntitlementsRequest $request): Entitlemen
111111
throw new InvalidSbsResponseException('Received non-array from SBS server');
112112
}
113113

114-
return EntitlementsResponse::fromData($jsonData);
114+
return AttributesResponse::fromData($jsonData);
115115
}
116116

117117
private function requestHeaders(): array

src/OpenConext/EngineBlockBundle/Sbs/SbsClientInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace OpenConext\EngineBlockBundle\Sbs;
2020

21-
use OpenConext\EngineBlockBundle\Sbs\Dto\EntitlementsRequest;
21+
use OpenConext\EngineBlockBundle\Sbs\Dto\AttributesRequest;
2222
use OpenConext\EngineBlockBundle\Sbs\Dto\AuthzRequest;
2323

2424
interface SbsClientInterface
@@ -31,7 +31,7 @@ interface SbsClientInterface
3131

3232
public function authz(AuthzRequest $request) : AuthzResponse;
3333

34-
public function requestEntitlementsFor(EntitlementsRequest $request) : EntitlementsResponse;
34+
public function requestAttributesFor(AttributesRequest $request) : AttributesResponse;
3535

3636
public function getInterruptLocationLink(string $nonce);
3737
}

src/OpenConext/EngineBlockFunctionalTestingBundle/Controllers/SbsController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public function interruptAction(Request $request): Response
7171
}
7272

7373
/**
74-
* The endpoint called by Engine to fetch the entitlements after the browser has made a trip to the interrupt action
74+
* The endpoint called by Engine to fetch the attributes after the browser has made a trip to the interrupt action
7575
* and has returned to the continue_url
7676
*/
77-
public function entitlementsAction()
77+
public function attributesAction()
7878
{
7979
return new JsonResponse([
80-
'attributes' => $this->sbsClientStateManager->getPreparedEntitlementsResponse()
80+
'attributes' => $this->sbsClientStateManager->getPreparedAttributesResponse()
8181
]);
8282
}
8383
}

src/OpenConext/EngineBlockFunctionalTestingBundle/Features/Context/EngineBlockContext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,19 +782,19 @@ public function authzWillReturnInvalidAttributes(): void
782782
}
783783

784784
/**
785-
* @Given /^the sbs server will return valid entitlements$/
785+
* @Given /^the sbs server will return valid attributes/
786786
*/
787-
public function entitlementsWillReturnValidAttributes(): void
787+
public function attributesWillReturnValidAttributes(): void
788788
{
789-
$this->sbsClientStateManager->prepareEntitlementsResponse($this->sbsClientStateManager->getValidMockAttributes());
789+
$this->sbsClientStateManager->prepareAttributesResponse($this->sbsClientStateManager->getValidMockAttributes());
790790
}
791791

792792
/**
793-
* @Given /^the sbs server will return invalid entitlements$/
793+
* @Given /^the sbs server will return invalid attributes/
794794
*/
795-
public function entitlementsWillReturnInvalidAttributes(): void
795+
public function attributesWillReturnInvalidAttributes(): void
796796
{
797-
$this->sbsClientStateManager->prepareEntitlementsResponse(['foo' => ['bar' => 'baz']]);
797+
$this->sbsClientStateManager->prepareAttributesResponse(['foo' => ['bar' => 'baz']]);
798798
}
799799

800800
/**

src/OpenConext/EngineBlockFunctionalTestingBundle/Features/SbsFlowIntegration.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Feature:
1414
Given the SP "SSO-SP" requires SRAM collaboration
1515
And feature "eb.feature_enable_sram_interrupt" is enabled
1616
And the sbs server will trigger the "interrupt" authz flow when called
17-
# And the sbs server will return valid entitlements ## @TODO Remove this endpoint call altogether?
17+
# And the sbs server will return valid attributes ## @TODO Remove this endpoint call altogether?
1818
When I log in at "SSO-SP"
1919
And I pass through EngineBlock
2020
And I pass through the IdP
@@ -58,11 +58,11 @@ Feature:
5858
Then the url should match "/feedback/unknown-error"
5959
And the response should contain "Logging in has failed"
6060

61-
Scenario: If the SBS authz check returns an 'interrupt' response, and the entitlements call to sbs returns an invalid response
61+
Scenario: If the SBS authz check returns an 'interrupt' response, and the attributes call to sbs returns an invalid response
6262
Given the SP "SSO-SP" requires SRAM collaboration
6363
And feature "eb.feature_enable_sram_interrupt" is enabled
6464
And the sbs server will trigger the "interrupt" authz flow when called
65-
# And the sbs server will return invalid entitlements ## @TODO remove entitlements call?
65+
# And the sbs server will return invalid attributes ## @TODO remove attributes call?
6666
When I log in at "SSO-SP"
6767
And I pass through EngineBlock
6868
And I pass through the IdP

src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/SbsClientStateManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SbsClientStateManager
3737
/**
3838
* @var array
3939
*/
40-
private $entitlements = [];
40+
private $attributes = [];
4141

4242
public function __construct(
4343
AbstractDataStore $dataStore
@@ -87,22 +87,22 @@ public function getValidMockAttributes(): array
8787
];
8888
}
8989

90-
public function prepareEntitlementsResponse(array $entitlements): void
90+
public function prepareAttributesResponse(array $attributes): void
9191
{
92-
$this->entitlements = $entitlements;
92+
$this->attributes = $attributes;
9393
$this->save();
9494
}
9595

96-
public function getPreparedEntitlementsResponse(): array
96+
public function getPreparedAttributesResponse(): array
9797
{
98-
return $this->dataStore->load()['entitlements'];
98+
return $this->dataStore->load()['attributes'];
9999
}
100100

101101
private function save()
102102
{
103103
$this->dataStore->save([
104104
'authz' => $this->authz,
105-
'entitlements' => $this->entitlements,
105+
'attributes' => $this->attributes,
106106
]);
107107
}
108108
}

src/OpenConext/EngineBlockFunctionalTestingBundle/Resources/config/routing.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ functional_testing_sram_interrupt:
8080
defaults:
8181
_controller: engineblock.functional_test.controller.sbs:interruptAction
8282

83-
functional_testing_sram_entitlements:
84-
path: "/entitlements"
83+
functional_testing_sram_attributes:
84+
path: "/attributes"
8585
defaults:
86-
_controller: engineblock.functional_test.controller.sbs:entitlementsAction
86+
_controller: engineblock.functional_test.controller.sbs:attributesAction

0 commit comments

Comments
 (0)