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

412/allow access token with cookie #1008

Open
wants to merge 7 commits into
base: 7.x-1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions plugins/authentication/RestfulAuthenticationCookie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@

class RestfulAuthenticationCookie extends RestfulAuthenticationBase implements RestfulAuthenticationInterface {

/**
* {@inheritdoc}
*/
public function applies(array $request = array(), $method = \RestfulInterface::GET) {
// Skip cookies auth if we have an access token.
if (variable_get('restful_prefer_access_token', FALSE) && isset($request['__application']['access_token'])) {
// The variable may be set if you want to be logged in both with a session
// cookie and with an access token, favoriting the access_token request
// see https://github.com/RESTful-Drupal/restful/issues/412.
return;
}
return TRUE;
}

/**
* Implements RestfulAuthenticationInterface::authenticate().
*/
Expand Down