Authorization improvements#3
Open
jamesmehorter wants to merge 7 commits into
Open
Conversation
Changes to setAccess():
+ setAccess() previously updated internal vars with those passed into the method.
+ The setting of internal class vars is now handled within each token fetching method. This removes the need for the setAccess method, and rightly so—the token fetching methods should handle this task (or possibly abstract it further later on).
+ setAccess() previously set the authentication header for the rest client.
+ The Authorization header for the rest client is now handled within it's own 'setAccessHeaders' method, and is called in each token fetching method. This was done with the same justification as the previous item.
Changes to checkAccess():
+ checkAccess() previously returned bool, but also refreshed the access token. That refresh has been abstracted out. It can now be called like so in usage code:
if ( $api->isAccessTokenExpired() ) {
$api->refreshAccess();
}
+ this allows developers to cache the $api object and refresh their token only when needed.
Now that we have a method to authenticate via password as well let's rename this method so both intuitively named
Again, the github diff shows odd whitespace—Hmm
If the token expiration has already occurred it's 'expired'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See commit messages for detail on each adjustment.
This PR accomplishes: