public function SimpleOauthAuthenticationTest::hasTokenValueProvider in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.4 tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::hasTokenValueProvider()
- 8.3 tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::hasTokenValueProvider()
- 5.x tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::hasTokenValueProvider()
File
- tests/
src/ Unit/ Authentication/ Provider/ SimpleOauthAuthenticationTest.php, line 48
Class
- SimpleOauthAuthenticationTest
- @coversDefaultClass \Drupal\simple_oauth\Authentication\Provider\SimpleOauthAuthenticationProvider @group simple_oauth
Namespace
Drupal\Tests\simple_oauth\Unit\Authentication\ProviderCode
public function hasTokenValueProvider() {
$data = [];
// 1. Authentication header.
$token = $this
->getRandomGenerator()
->name();
$request = new Request();
$request->headers
->set('Authorization', 'Bearer ' . $token);
$data[] = [
$request,
TRUE,
];
// 2. Authentication header. Trailing white spaces.
$token = $this
->getRandomGenerator()
->name();
$request = new Request();
$request->headers
->set('Authorization', ' Bearer ' . $token);
$data[] = [
$request,
TRUE,
];
// 3. Authentication header. No white spaces.
$token = $this
->getRandomGenerator()
->name();
$request = new Request();
$request->headers
->set('Authorization', 'Foo' . $token);
$data[] = [
$request,
FALSE,
];
// 4. Authentication header. Fail: no token.
$request = new Request();
$data[] = [
$request,
FALSE,
];
return $data;
}