public function testGetTokenFromJwt() { $xml = file_get_contents(__DIR__ . '/samples/token-without-consumer.xml'); $response = new Response('200', null, $xml); $this->apiMock->addResponse($response); $token = $this->fetcher->getAccessTokenFromJwt('0005548e3bfe0a47938fd5b1c8369ff1'); $correctToken = new Token('2143f7db7642b3687e90d718b79a42ce', '4c06eb61aa814a057578640ee61ea420', new User('12346093-0e7e-4803-be0b-69b24c145f89', 'testtesttest', '*****@*****.**')); $this->assertEquals($correctToken, $token); }
/** * @param $consumerKey * @return \CultuurNet\SymfonySecurityOAuth\Model\Consumer */ public function getConsumerByKey($consumerKey) { $uitid_consumer = $this->fetcher->getConsumer($consumerKey); $this->consumer = new Consumer(); $this->consumer->setConsumerKey($uitid_consumer->getKey()); $this->consumer->setConsumerSecret($uitid_consumer->getSecret()); $this->consumer->setName($uitid_consumer->getName()); return $this->consumer; }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $baseUrl = $this->resolveBaseUrl('auth', $input); $consumerCredentials = $this->session->getConsumerCredentials(); $fetcher = new UitidCredentialsFetcher($baseUrl, $consumerCredentials); $consumerKey = $input->getArgument('consumer'); $consumer = $fetcher->getConsumer($consumerKey); $output->writeln('consumer key: ' . $consumer->getKey()); $output->writeln('consumer name: ' . $consumer->getName()); $output->writeln('consumer secret: ' . $consumer->getSecret()); }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $baseUrl = $this->resolveBaseUrl('auth', $input); $consumerCredentials = $this->session->getConsumerCredentials(); $fetcher = new UitidCredentialsFetcher($baseUrl, $consumerCredentials); $tokenKey = $input->getArgument('token'); $token = $fetcher->getAccessToken($tokenKey); $output->writeln('token: ' . $token->getToken()); $output->writeln('token secret: ' . $token->getTokenSecret()); $output->writeln('consumer key: ' . $token->getConsumer()->getKey()); $output->writeln('consumer name: ' . $token->getConsumer()->getName()); $output->writeln('consumer secret: ' . $token->getConsumer()->getSecret()); $output->writeln('user uid: ' . $token->getUser()->getUid()); $output->writeln('user nick: ' . $token->getUser()->getNick()); $output->writeln('user email: ' . $token->getUser()->getEmail()); }