mijndomein/dreamcommerce-sso-client-bundle
A Symfony bundle that integrates the DreamCommerce SSO client, providing configuration, service wiring, and authentication helpers so applications can add DreamCommerce single sign-on with minimal setup. It streamlines dependency injection and client initialization for seamless SSO integration in Sy...
This bundle is a thin Symfony 2 bridge around the DreamCommerce SSO client. It has no stars, no dependents, and no visible community, so treat the source as the documentation.
mijndomein/dreamcommerce-sso-client-bundle and its version constraints before writing code against it. If it is not published, add the GitHub repository as a VCS source in composer.json and pin a specific commit.
composer require mijndomein/dreamcommerce-sso-client-bundle
app/AppKernel.php:
$bundles = [
// ...
new DreamCommerce\Bundle\SSOClientBundle\DreamCommerceSSOClientBundle(),
];
The exact class name is the first thing to verify — open the repository root and find the *Bundle.php file.Resources/config/routing.yml or routing.xml and import it in app/config/routing.yml. If it only provides services, skip this.DependencyInjection/Configuration.php to find the configuration root key and the supported options. It will look roughly like:
# app/config/config.yml
dreamcommerce_sso_client:
client_id: "%sso_client_id%"
client_secret: "%sso_client_secret%"
redirect_uri: "%sso_redirect_uri%"
# endpoint/base_url options as defined by the bundle
Put credentials in parameters.yml (or environment-specific config), never in the committed bundle config.README.md — if it exists at all.DependencyInjection/Configuration.php — the authoritative list of options.DependencyInjection/*Extension.php — how config maps to service arguments.Resources/config/services.yml — service IDs you will inject or override.First use case: inject the SSO client service into a controller and perform the login redirect. The smallest useful slice is:
public function loginAction()
{
return $this->redirect($this->get('dreamcommerce_sso_client')->getAuthorizationUrl());
}
Then a callback route that exchanges the returned code/token for an identity. Get that round trip working against a sandbox before touching Symfony's security layer.
Inject the client, never instantiate it. The bundle exists to give you a configured service. Use constructor injection in your own services (or $this->get(...) in a Symfony 2 controller) and let the bundle own credentials and HTTP configuration. This also makes the client mockable in tests.
Keep a three-step controller flow.
loginAction — generate state, store it in the session, redirect to the IdP.callbackAction — validate state, exchange the code/token for a user identity, then either log the user in or hand off to your own user provisioning.logoutAction — clear the local session and, if the IdP supports it, redirect to its logout endpoint.Bridge into Symfony security deliberately. Symfony 2 predates Guard, so you have two realistic options:
security.firewalls, orSecurityContext::setToken() with a UsernamePasswordToken after you have resolved the local user.Whichever you pick, isolate it in one service so the rest of the app never talks to the SSO client directly:
class SsoAuthenticator
{
public function __construct(SsoClient $client, UserProviderInterface $users, TokenStorageInterface $tokenStorage) { ... }
public function authenticate($code)
{
$identity = $this->client->fetchIdentity($code); // adapt to actual API
$user = $this->users->loadUserByUsername($identity->getEmail());
$this->tokenStorage->setToken(new UsernamePasswordToken($user, null, 'main', $user->getRoles()));
}
}
Map SSO identity to local users explicitly. Decide up front whether SSO users are auto-provisioned or must already exist. Auto-provisioning needs a strategy for collisions (email already registered locally) and for attribute changes (name, roles) on every login. A small UserManager service that does "find or create, then sync" keeps this out of the controller.
Configuration stays environment-specific. The redirect URI in particular is almost always different per environment (localhost vs staging vs production). Drive it from parameters.yml and set it in the IdP's client registration for each environment.
Override bundled services by ID. If you need a different HTTP client, base URL, or logging, redeclare the bundle's service ID in your app's services.yml (or use a compiler pass). That is the intended extension point for a Symfony 2 bundle and avoids forking.
Test the seam, not the bundle. Unit-test your authenticator with a mocked client service. Integration-test only the callback route, using a stub that returns a fixed identity. You will never get good test coverage inside a third-party bundle you do not control.
SsoAuthenticator rather than the bundle's client class.DependencyInjection/ before trusting a config key; do not infer option names from the README.$this->get('...') in a controller usually works. If the bundle marks services private (or you upgrade later), switch to constructor injection immediately rather than fighting the container.http vs https, port numbers, and www vs apex all count. Register every environment's exact URI at the IdP and mirror it byte-for-byte in config.state yourself. Do not assume the bundle does CSRF protection on the callback. Store a random value in the session at login, compare it at callback, and fail closed.dreamcommerce SSO client as the real dependency. When debugging behavior, drop down into that package's source and version — the bundle is only wiring. Pin both versions in composer.json and review changelogs before bumping.How can I help you explore Laravel packages today?