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

Make authentication check for each API method explicit at build time #55

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

phansys
Copy link
Member

@phansys phansys commented Jan 24, 2020

Since at build time we know if a method requires or not authentication based in their name, build the methods including the resolved value instead of checking that at running time.

BEFORE:

// get params array for request
$params = $this->getRequestParamsArray($params);

// check if we've to authenticate
$auth = !in_array('apiinfo.version', self::$anonymousFunctions, true);

// request
return $this->request('apiinfo.version', $params, $arrayKeyProperty, $auth);

AFTER:

return $this->request('apiinfo.version', $this->getRequestParamsArray($params), $arrayKeyProperty, false);

phansys added a commit that referenced this pull request Jan 24, 2020
…uild time (phansys)

This PR was merged into the master branch.

Discussion
----------

Since at build time we know if a method requires or not authentication based in their name, build the methods including the resolved value instead of checking that at running time.

**BEFORE**:
```php
// get params array for request
$params = $this->getRequestParamsArray($params);

// check if we've to authenticate
$auth = !in_array('apiinfo.version', self::$anonymousFunctions, true);

// request
return $this->request('apiinfo.version', $params, $arrayKeyProperty, $auth);
```
**AFTER**:
```php
return $this->request('apiinfo.version', $this->getRequestParamsArray($params), $arrayKeyProperty, false);
```

Commits
-------

b012ded Make authentication check for each API method explicit at build time
@phansys phansys merged commit b012ded into confirm:master Jan 24, 2020
@phansys phansys deleted the auth_check branch January 24, 2020 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants