|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cryptocurrency News Articles
How to configure a SAML configuration by customer for my SaaS application
May 27, 2024 at 05:03 am
For my SaaS application i want to configure a SAML configuration by customer. I want to be aible to change the configuration of my Symfony One Login Bundle to fit witht he configuration of my customer for their need.

This guide will help you configure SAML SSO for your Symfony application on a per-customer basis. You'll need to adjust the configuration of the Symfony One Login Bundle to match the specific requirements of each customer.
First, determine the appropriate bundle based on your Symfony version:
* For Symfony 6, install the nbgrp/onelogin-saml-bundle from GitHub.
* For earlier Symfony versions, start with the hslaovich/OneloginSamlBundle from GitHub.
Next, add the default configuration. If this step is skipped, the application will fail to function properly. Edit the config/packages/nbgrp_onelogin_saml.yaml file as follows:
```yaml
nbgrp_onelogin_saml:
idp:
default:
settings:
assertionConsumerService:
url: '%env(SAML_ASSERTION_CONSUMER_SERVICE)%'
issuer: '%env(SAML_ISSUER)%'
spEntityId: '%env(SAML_SP_ENTITY_ID)%'
x509cert: '%env(SAML_X509_CERT)%'
```
Update the config/packages/security.yaml file as well:
```yaml
security:
encoders:
SymfonyComponentSecurityCoreUserUser: plaintext
providers:
saml:
nbgrp_onelogin_saml
firewalls:
main:
saml:
path: ^/saml
provider: saml
entry_point: nbgrp_onelogin_saml_entry_point
logout_entry_point: nbgrp_onelogin_saml_logout_entry_point
logout_success_handler: nbgrp_onelogin_saml_logout_success_handler
logout:
path: ^/logout$
```
The nbgrp/onelogin-saml-bundle utilizes compilerpass to inject configuration into a registry in an array indexed by idp, which is then used throughout the application. We'll override this functionality and load the configuration dynamically from the database based on the hostname.
Create a new service in the api/config/services.yaml file:
```yaml
services:
app.saml_configuration_loader:
class: AppSecuritySamlConfigurationLoader
arguments:
- '@doctrine.orm.default_entity_manager'
```
Override relevant portions of the bundle:
Those files will be overridden to enable dynamic configuration of the login controller, metadata, and authenticator.
Login Controller
Override the api/vendor/nbgrp/onelogin-saml-bundle/src/Controller/Login.php file to utilize our configuration.
In the __construct method, we autowire and add our service.
```php
use AppSecuritySamlConfigurationLoader;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentDependencyInjectionContainerInterface;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingAnnotationRoute;
use SymfonyComponentSecurityHttpAuthenticationAuthenticationUtils;
class LoginController extends AbstractController
{
private $samlConfigurationLoader;
public function __construct(ContainerInterface $container, SamlConfigurationLoader $samlConfigurationLoader)
{
parent::__construct($container);
$this->samlConfigurationLoader = $samlConfigurationLoader;
}
public function login(AuthenticationUtils $authenticationUtils, Request $request): Response
{
$host = $request->server->get('HTTP_HOST');
$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);
// ...
}
}
```
Metadata
Line 19: Add our service.
```php
use AppSecuritySamlConfigurationLoader;
use SymfonyComponentDependencyInjectionContainerInterface;
class MetadataController extends Controller
{
public static function create(ContainerInterface $container): MetadataController
{
$samlConfigurationLoader = $container->get(SamlConfigurationLoader::class);
return new self($samlConfigurationLoader);
}
public function __invoke(Request $request): Response
{
$host = $request->server->get('HTTP_HOST');
$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);
// ...
}
}
```
Disclaimer:info@kdj.com
The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!
If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.
-
-
- Consensus 2026 Miami: Web3, Blockchain, Cryptocurrency, NFTs, Metaverse, Conference, May 5th — Where Wall Street Meets the Digital Frontier
- May 01, 2026 at 11:27 pm
- Miami buzzes as Consensus 2026 approaches on May 5th, highlighting Web3, blockchain, crypto, NFTs, and the metaverse's shift from hype to institutional and sustainable reality.
-
-
- Bitcoin Miners Electrify the Grid: Ohio Gas Plant Acquisition Powers Up a New Era for Digital Gold
- Apr 30, 2026 at 10:38 pm
- The Bitcoin mining industry is undergoing a significant transformation, with major players aggressively expanding operations and strategically acquiring energy assets like Ohio gas plants to solidify their future in the digital economy.
-
-
- Solana's Slippery Slope: Price Prediction Points to Resistance Loss and Potential Further Drops
- Apr 30, 2026 at 09:08 pm
- Solana is struggling to break key resistance, signaling potential downside. Repeated rejections at $86-$88, coupled with a broken short-term pattern, point to targets as low as $67, or even $40, as sellers maintain control. Investors should watch critical support levels closely.
-
-
- NYC's New Beat: Staking Systems, USD1, and Governance Drive Crypto's Next Wave
- Apr 30, 2026 at 03:02 pm
- From lucrative USD1 earning events to robust governance models, the crypto sphere is buzzing with innovations reshaping how we engage with digital assets, focusing on long-term commitment and stablecoin utility.
-
- OKX Unveils Agent Payments Protocol: Ushering in a New Era of AI Transactions
- Apr 30, 2026 at 02:53 pm
- OKX launches its Agent Payments Protocol (APP), an open standard for AI-driven commerce, enabling agents to manage full business cycles. Explore the implications for AI transactions and agentic payments.

































