You are here

public function SimpleOauthAuthenticationTest::hasTokenValueProvider in Simple OAuth (OAuth2) & OpenID Connect 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::hasTokenValueProvider()
  2. 8.2 tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::hasTokenValueProvider()
  3. 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 67

Class

SimpleOauthAuthenticationTest
@coversDefaultClass \Drupal\simple_oauth\Authentication\Provider\SimpleOauthAuthenticationProvider @group simple_oauth

Namespace

Drupal\Tests\simple_oauth\Unit\Authentication\Provider

Code

public function hasTokenValueProvider() {
  $token = $this
    ->getRandomGenerator()
    ->name();
  $data = [];

  // 1. Authentication header.
  $data[] = [
    'Bearer ' . $token,
    TRUE,
  ];

  // 2. Authentication header. Trailing white spaces.
  $data[] = [
    '  Bearer ' . $token,
    TRUE,
  ];

  // 3. Authentication header. No white spaces.
  $data[] = [
    'Foo' . $token,
    FALSE,
  ];

  // 4. Authentication header. Empty value.
  $data[] = [
    '',
    FALSE,
  ];

  // 5. Authentication header. Fail: no token.
  $data[] = [
    NULL,
    FALSE,
  ];
  return $data;
}