Skip to content

Commit 90fbdd5

Browse files
authored
Merge pull request #2 from Micro-PHP/v1.1-release
v1.1 - Make configurable: realm name, default scopes
2 parents f49847a + 94ede87 commit 90fbdd5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"description": "Micro Framework: Adapter for using Keycloak as an authorization server based on the OAuth2 protocol.",
44
"type": "library",
55
"license": "MIT",
6-
"version": "1.0",
76
"autoload": {
87
"psr-4": {
98
"Micro\\Plugin\\OAuth2\\Client\\Keycloak\\": "src/"

src/Configuration/Provider/ProviderConfiguration.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@
2121
*/
2222
class ProviderConfiguration extends OAuth2ClientProviderConfiguration implements KeycloakProviderConfigurationInterface
2323
{
24+
const CFG_REALM = 'MICRO_OAUTH2_%s_REALM';
25+
const CFG_SCOPES = 'MICRO_OAUTH2_%s_SCOPES';
26+
2427
/**
2528
* {@inheritDoc}
2629
*/
2730
public function getRealm(): string
2831
{
29-
return 'micro';
32+
return $this->get(self::CFG_REALM, 'micro');
3033
}
3134

3235
/**
3336
* {@inheritDoc}
3437
*/
3538
public function getScopesDefault(): array
3639
{
37-
return ['email', 'profile'];
40+
return $this->explodeStringToArray($this->get(self::CFG_SCOPES, 'email,profile'));
3841
}
3942

4043
/**

src/OAuth2KeycloakProviderPlugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use League\OAuth2\Client\Provider\AbstractProvider;
1717
use Micro\Component\DependencyInjection\Container;
1818
use Micro\Framework\Kernel\Plugin\ConfigurableInterface;
19-
use Micro\Framework\Kernel\Plugin\DependencyProviderInterface;
19+
use Micro\Framework\Kernel\Plugin\PluginDependedInterface;
2020
use Micro\Framework\Kernel\Plugin\PluginConfigurationTrait;
2121
use Micro\Plugin\OAuth2\Client\Configuration\OAuth2ClientPluginConfigurationInterface;
2222
use Micro\Plugin\OAuth2\Client\Keycloak\Provider\OAuth2Provider;
@@ -28,7 +28,7 @@
2828
*
2929
* @method OAuth2ClientPluginConfigurationInterface configuration()
3030
*/
31-
class OAuth2KeycloakProviderPlugin implements OAuth2ClientProviderPluginInterface, DependencyProviderInterface, ConfigurableInterface
31+
class OAuth2KeycloakProviderPlugin implements OAuth2ClientProviderPluginInterface, PluginDependedInterface, ConfigurableInterface
3232
{
3333

3434
use PluginConfigurationTrait;
@@ -62,7 +62,7 @@ public function getType(): string
6262
/**
6363
* {@inheritDoc}
6464
*/
65-
public function provideDependencies(Container $container): void
65+
public function getDependedPlugins(Container $container): void
6666
{
6767
$this->container = $container;
6868
}

0 commit comments

Comments
 (0)