/**
  * {@inheritdoc}
  */
 public function check(OAuth2Token $token, OAuth2 $configuration)
 {
     if (null === $configuration->getClientType()) {
         return;
     }
     $result = $this->isTypeValid($configuration->getClientType(), $token->getClient());
     if (false === $result) {
         return 'Bad client type';
     }
 }
 /**
  * {@inheritdoc}
  */
 public function check(OAuth2Token $token, OAuth2 $configuration)
 {
     if (null === $configuration->getClientType()) {
         return;
     }
     if (self::TYPE_PUBLIC === $configuration->getClientType() && 'none' === $token->getClient()->get('token_endpoint_auth_method')) {
         return;
     }
     if (self::TYPE_CONFIDENTIAL === $configuration->getClientType() && 'none' !== $token->getClient()->get('token_endpoint_auth_method')) {
         return;
     }
     return 'Resource owner not authorized.';
 }