Merge branch 'develop'

This commit is contained in:
ELMAKHROUBI
2020-12-11 18:38:28 +01:00
4 changed files with 13 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ class ABELkeycloakBearerOnlyAdapterExtension extends Extension
$definition->replaceArgument(1, $config['realm']);
$definition->replaceArgument(2, $config['client_id']);
$definition->replaceArgument(3, $config['client_secret']);
$definition->replaceArgument(4, $config['ssl_verification']);
}
public function getAlias()

View File

@@ -31,6 +31,10 @@ class Configuration implements ConfigurationInterface
->scalarNode("client_secret")
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('ssl_verification')
->defaultFalse()
->treatNullLike(false)
->end();
return $treeBuilder;

View File

@@ -17,6 +17,7 @@
<argument/>
<argument/>
<argument/>
<argument/>
</service>
<service id="ABEL\Bundle\keycloakBearerOnlyAdapterBundle\Security\User\KeycloakBearerUserProvider" alias="abel_keycloak_bearer_only_adapter.keycloak_bearer_user_provider" />

View File

@@ -28,6 +28,10 @@ class KeycloakBearerUserProvider implements UserProviderInterface
* @var string
*/
private $client_secret;
/**
* @var mixed
*/
private $sslVerification;
/**
* KeycloakBearerUserProvider constructor.
@@ -36,12 +40,13 @@ class KeycloakBearerUserProvider implements UserProviderInterface
* @param string $client_id
* @param string $client_secret
*/
public function __construct(string $issuer, string $realm, string $client_id, string $client_secret)
public function __construct(string $issuer, string $realm, string $client_id, string $client_secret, $sslVerification)
{
$this->issuer = $issuer;
$this->realm = $realm;
$this->client_id = $client_id;
$this->client_secret = $client_secret;
$this->sslVerification = $sslVerification;
}
/**
@@ -71,6 +76,7 @@ class KeycloakBearerUserProvider implements UserProviderInterface
'http' => '', // Use this proxy with "http"
'https' => '', // Use this proxy with "https",
],
'verify' => $this->sslVerification,
'http_errors' => false
]);