Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SecureUser ID Store #126

Merged
merged 6 commits into from
Jan 18, 2022
Merged

Add SecureUser ID Store #126

merged 6 commits into from
Jan 18, 2022

Conversation

Baggerone
Copy link
Contributor

No description provided.

@Baggerone Baggerone requested a review from a team January 14, 2022 15:36
'email' => User::EMAIL,
'username' => User::USERNAME,
'locked' => User::LOCKED,
'manager_email' => User::MANAGER_EMAIL,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this complete? I thought Schram added 2 manager fields. Just checking.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Schram's addition was just to the workday store for adding the HR fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Not all fields must be listed here.

*/
public function getUsersChangedSince(int $unixTimestamp)
{
throw new Exception(__FUNCTION__ . ' not yet implemented');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be pushing code with "not yet implemented" things?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok because configuration dictates which features are needed for a given ID Store. This method is only used for incremental sync. Presumably, secureuser is fine with running full sync each time.

'apiSecret',
];
foreach ($requiredProperties as $requiredProperty) {
if (empty($this->$requiredProperty)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the PHP Magic which will use the new ID_STORE_CONFIG variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application/common/config/main.php line 20

$idStoreOptionalConfig = Env::getArrayFromPrefix('ID_STORE_CONFIG_');

and then lines 73-77

       'idStore' => ArrayHelper::merge([
            'class' => IdStoreBase::getAdapterClassFor(
                Env::get('ID_STORE_ADAPTER')
            ),
        ], $idStoreOptionalConfig),

{
$client = $this->getHttpClient();

$api_sig = hash_hmac('sha256', time().$this->apiKey, $this->apiSecret);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? time().$this->apiKey

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Concatenation of the time and the api key.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, haha, I was reading the . as if it was Go. I think maybe spaces on each side of the . are more standard.

Suggested change
$api_sig = hash_hmac('sha256', time().$this->apiKey, $this->apiSecret);
$api_sig = hash_hmac('sha256', time() . $this->apiKey, $this->apiSecret);

public function iAskTheIdStoreForASpecificActiveUser()
{
$this->activeEmployeeId = Env::requireEnv('TEST_SECURE_USER_EMPLOYEE_ID');
$this->result = $this->idStore->getActiveUser($this->activeEmployeeId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see, this method is only used for incremental sync. Do you still want to include it in the test? And maybe include a test for getAllActiveUsers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since getActiveUser calls getAllActiveUsers, this is testing both in a way. I didn't want the test to have to validate a long list of users. As long as one known user comes through, I assume that's good enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good point. Thanks for clarifying.

@Baggerone Baggerone merged commit c1ec71c into develop Jan 18, 2022
@Baggerone Baggerone deleted the feature/secureuser branch January 18, 2022 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants