Skip to content
Snippets Groups Projects
Commit d5e3f13c authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Remove more references to core bundle internals

parent 234ce5f9
No related branches found
No related tags found
No related merge requests found
Pipeline #52183 passed
<?php
declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests;
use DBP\API\KeycloakBundle\Keycloak\KeycloakBearerUserProviderInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
class DummyUserProvider implements KeycloakBearerUserProviderInterface
{
private $user;
private $token;
public function __construct(UserInterface $user, string $token)
{
$this->user = $user;
$this->token = $token;
}
public function loadUserByToken(string $accessToken): UserInterface
{
if ($this->token !== $accessToken) {
throw new AuthenticationException('invalid token');
}
return $this->user;
}
public function loadUserByValidatedToken(array $jwt): UserInterface
{
return $this->user;
}
}
<?php
declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests;
use DBP\API\CoreBundle\API\UserSessionInterface;
class DummyUserSession implements UserSessionInterface
{
private $jwt;
private $id;
private $roles;
public function __construct(?string $id = 'id', array $roles = [])
{
$this->id = $id;
$this->roles = $roles;
}
public function setSessionToken(?array $jwt): void
{
$this->jwt = $jwt;
}
public function getUserIdentifier(): ?string
{
return $this->id;
}
public function getUserRoles(): array
{
return $this->roles;
}
public function getSessionLoggingId(): ?string
{
return 'logging-id';
}
public function getSessionCacheKey(): ?string
{
return 'cache';
}
public function getSessionTTL(): int
{
return 42;
}
}
......@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests\Keycloak;
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
use DBP\API\CoreBundle\Keycloak\KeycloakBearerAuthenticator;
use DBP\API\CoreBundle\Keycloak\KeycloakBearerUser;
use DBP\API\CoreBundle\TestUtils\DummyUserProvider;
use DBP\API\KeycloakBundle\Keycloak\KeycloakBearerAuthenticator;
use DBP\API\KeycloakBundle\Keycloak\KeycloakBearerUser;
use DBP\API\KeycloakBundle\Tests\DummyUserProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
......
......@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests\Keycloak;
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
use DBP\API\CoreBundle\Keycloak\KeycloakBearerUserProvider;
use DBP\API\CoreBundle\TestUtils\DummyUserSession;
use DBP\API\KeycloakBundle\Keycloak\KeycloakBearerUserProvider;
use DBP\API\KeycloakBundle\Tests\DummyUserSession;
class KeycloakBearerUserProviderTest extends ApiTestCase
{
......
......@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests\Keycloak;
use DBP\API\CoreBundle\Keycloak\KeycloakBearerUser;
use DBP\API\KeycloakBundle\Keycloak\KeycloakBearerUser;
use PHPUnit\Framework\TestCase;
class KeycloakBearerUserTest extends TestCase
......
......@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests\Keycloak;
use DBP\API\CoreBundle\Keycloak\Keycloak;
use DBP\API\CoreBundle\Keycloak\KeycloakLocalTokenValidator;
use DBP\API\CoreBundle\Keycloak\TokenValidationException;
use DBP\API\KeycloakBundle\Keycloak\Keycloak;
use DBP\API\KeycloakBundle\Keycloak\KeycloakLocalTokenValidator;
use DBP\API\KeycloakBundle\Keycloak\TokenValidationException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
......
......@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests\Keycloak;
use DBP\API\CoreBundle\Keycloak\Keycloak;
use DBP\API\CoreBundle\Keycloak\KeycloakRemoteTokenValidator;
use DBP\API\CoreBundle\Keycloak\TokenValidationException;
use DBP\API\KeycloakBundle\Keycloak\Keycloak;
use DBP\API\KeycloakBundle\Keycloak\KeycloakRemoteTokenValidator;
use DBP\API\KeycloakBundle\Keycloak\TokenValidationException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
......
......@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace DBP\API\KeycloakBundle\Tests\Keycloak;
use DBP\API\CoreBundle\Keycloak\Keycloak;
use DBP\API\KeycloakBundle\Keycloak\Keycloak;
use PHPUnit\Framework\TestCase;
class KeycloakTest extends TestCase
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment