10 Commits

Author SHA1 Message Date
El. Abdellah
43399b443e Update README.md 2023-02-20 14:28:39 +01:00
El. Abdellah
727ade1a19 Merge pull request #11 from tricsusz/master
remove deprecated Serializable interface
2023-02-20 14:23:42 +01:00
88ec7d7bb1 remove deprecated Serializable interface 2023-02-20 14:04:43 +01:00
El. Abdellah
8c8ceb1279 Update README.md 2022-04-21 02:34:37 +02:00
El. Abdellah
f11d97ced0 Merge pull request #8 from tricsusz/master
remove /auth from Keycloak URL
2022-04-21 02:14:14 +02:00
fc2d81b9ad remove /auth from Keycloak URL 2022-04-19 19:11:39 +02:00
El. Abdellah
87909a1c15 Update README.md 2022-03-06 19:36:11 +01:00
El. Abdellah
f254ab52ac Merge pull request #6 from el-abdel/develop
Add compatibility with Symfony V6
2022-03-06 19:34:25 +01:00
el-abdel
570008ab6e fix compatibility 2022-03-06 18:49:47 +01:00
abdel
1f88ce8cb0 add compatibility with sf6 2022-03-06 18:28:33 +01:00
6 changed files with 18 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ namespace ABEL\Bundle\keycloakBearerOnlyAdapterBundle;
use ABEL\Bundle\keycloakBearerOnlyAdapterBundle\DependencyInjection\ABELkeycloakBearerOnlyAdapterExtension; use ABEL\Bundle\keycloakBearerOnlyAdapterBundle\DependencyInjection\ABELkeycloakBearerOnlyAdapterExtension;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Bundle\Bundle;
class ABELkeycloakBearerOnlyAdapterBundle extends Bundle class ABELkeycloakBearerOnlyAdapterBundle extends Bundle
@@ -12,7 +13,7 @@ class ABELkeycloakBearerOnlyAdapterBundle extends Bundle
/** /**
* @return ExtensionInterface|null * @return ExtensionInterface|null
*/ */
public function getContainerExtension() public function getContainerExtension(): ?ExtensionInterface
{ {
if (null === $this->extension) { if (null === $this->extension) {
$this->extension = new ABELkeycloakBearerOnlyAdapterExtension(); $this->extension = new ABELkeycloakBearerOnlyAdapterExtension();

View File

@@ -27,7 +27,7 @@ class ABELkeycloakBearerOnlyAdapterExtension extends Extension
$definition->replaceArgument(4, $config['ssl_verification']); $definition->replaceArgument(4, $config['ssl_verification']);
} }
public function getAlias() public function getAlias(): string
{ {
return 'abel_keycloak_bearer_only_adapter'; return 'abel_keycloak_bearer_only_adapter';
} }

View File

@@ -56,6 +56,11 @@ OAUTH_KEYCLOAK_CLIENT_SECRET=my_bearer_client_secret
###< Abel_keycloak_bearer_only_adapter ### ###< Abel_keycloak_bearer_only_adapter ###
... ...
``` ```
> Since Keycloak 17 the default distribution is now powered by **Quarkus**, while the legacy **WildFly** powered distribution will still be around until June 2022 <br>
> The new distribution introduces a number of breaking changes, including: <br>
> - `/auth` removed from the default context path <br>
> ⚠️ **If you are using a legacy version make sure to include /auth in OAUTH_KEYCLOAK_ISSUER** <br>
> Example: `keycloak:8080/auth`
In case of using Keycloak with Docker locally replace **issuer** value with your keycloak container reference in the network In case of using Keycloak with Docker locally replace **issuer** value with your keycloak container reference in the network
@@ -103,3 +108,4 @@ To configure keycloak to work with this bundle, [here](./Resources/docs/keycloak
| V1.0.1 | >=4.0.0 <5.0.0 | | V1.0.1 | >=4.0.0 <5.0.0 |
| V1.1.* (uses old authentication systeme with guard) | >=5.0.0 <6.0.0 | | V1.1.* (uses old authentication systeme with guard) | >=5.0.0 <6.0.0 |
| V1.2.* (uses new authentication systeme) | >=5.3.0 <6.0.0 | | V1.2.* (uses new authentication systeme) | >=5.3.0 <6.0.0 |
| V1.3.* | >=6.0.0 <7.0.0 |

View File

@@ -6,7 +6,7 @@ namespace ABEL\Bundle\keycloakBearerOnlyAdapterBundle\Security\User;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
class KeycloakBearerUser implements UserInterface, \Serializable class KeycloakBearerUser implements UserInterface
{ {
/** /**
* @var string * @var string
@@ -202,7 +202,7 @@ class KeycloakBearerUser implements UserInterface, \Serializable
* *
* @return array (Role|string)[] The user roles * @return array (Role|string)[] The user roles
*/ */
public function getRoles() public function getRoles(): array
{ {
return $this->roles; return $this->roles;
} }
@@ -270,7 +270,7 @@ class KeycloakBearerUser implements UserInterface, \Serializable
* @return string the string representation of the object or null * @return string the string representation of the object or null
* @since 5.1.0 * @since 5.1.0
*/ */
public function serialize() public function __serialize()
{ {
return serialize(array( return serialize(array(
$this->sub, $this->sub,
@@ -293,7 +293,7 @@ class KeycloakBearerUser implements UserInterface, \Serializable
* @return void * @return void
* @since 5.1.0 * @since 5.1.0
*/ */
public function unserialize($serialized) public function __unserialize($serialized)
{ {
list ( list (
$this->sub, $this->sub,

View File

@@ -100,7 +100,7 @@ class KeycloakBearerUserProvider implements UserProviderInterface{
'base_uri' => $this->issuer, 'base_uri' => $this->issuer,
]); ]);
$response = $client->post('/auth/realms/'.$this->realm.'/protocol/openid-connect/token/introspect', [ $response = $client->post('/realms/'.$this->realm.'/protocol/openid-connect/token/introspect', [
'auth' => [$this->client_id, $this->client_secret], 'auth' => [$this->client_id, $this->client_secret],
'form_params' => [ 'form_params' => [
'token' => $accessToken, 'token' => $accessToken,

View File

@@ -12,10 +12,10 @@
"minimum-stability": "stable", "minimum-stability": "stable",
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"symfony/config": "^5.3", "symfony/config": "^6.0",
"symfony/dependency-injection": "^5.3", "symfony/dependency-injection": "^6.0",
"symfony/http-kernel": "^5.3", "symfony/http-kernel": "^6.0",
"symfony/security-bundle": "^5.3", "symfony/security-bundle": "^6.0",
"guzzlehttp/guzzle": "^6.3", "guzzlehttp/guzzle": "^6.3",
"ext-json": "*" "ext-json": "*"
}, },