Marktkapitalisierung: $2.1862T -0.10%
Volumen (24h): $65.0919B 2.38%
  • Marktkapitalisierung: $2.1862T -0.10%
  • Volumen (24h): $65.0919B 2.38%
  • Angst- und Gier-Index:
  • Marktkapitalisierung: $2.1862T -0.10%
Kryptos
Themen
Cryptospedia
Nachricht
Cryptostopics
Videos
Top -Nachrichten
Kryptos
Themen
Cryptospedia
Nachricht
Cryptostopics
Videos
bitcoin
bitcoin

$87959.907984 USD

1.34%

ethereum
ethereum

$2920.497338 USD

3.04%

tether
tether

$0.999775 USD

0.00%

xrp
xrp

$2.237324 USD

8.12%

bnb
bnb

$860.243768 USD

0.90%

solana
solana

$138.089498 USD

5.43%

usd-coin
usd-coin

$0.999807 USD

0.01%

tron
tron

$0.272801 USD

-1.53%

dogecoin
dogecoin

$0.150904 USD

2.96%

cardano
cardano

$0.421635 USD

1.97%

hyperliquid
hyperliquid

$32.152445 USD

2.23%

bitcoin-cash
bitcoin-cash

$533.301069 USD

-1.94%

chainlink
chainlink

$12.953417 USD

2.68%

unus-sed-leo
unus-sed-leo

$9.535951 USD

0.73%

zcash
zcash

$521.483386 USD

-2.87%

Nachrichtenartikel zu Kryptowährungen

So konfigurieren Sie eine SAML-Konfiguration durch den Kunden für meine SaaS-Anwendung

May 27, 2024 at 05:03 am

Für meine SaaS-Anwendung möchte ich eine SAML-Konfiguration durch den Kunden konfigurieren. Ich möchte die Konfiguration meines Symfony One Login Bundle ändern können, um sie an die Konfiguration meines Kunden anzupassen.

So konfigurieren Sie eine SAML-Konfiguration durch den Kunden für meine SaaS-Anwendung

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.

Dieser Leitfaden hilft Ihnen bei der Konfiguration von SAML SSO für Ihre Symfony-Anwendung auf Kundenbasis. Sie müssen die Konfiguration des Symfony One Login Bundle an die spezifischen Anforderungen jedes Kunden anpassen.

First, determine the appropriate bundle based on your Symfony version:

Bestimmen Sie zunächst das passende Bundle basierend auf Ihrer Symfony-Version:

* For Symfony 6, install the nbgrp/onelogin-saml-bundle from GitHub.

* Für Symfony 6 installieren Sie das nbgrp/onelogin-saml-bundle von GitHub.

* For earlier Symfony versions, start with the hslaovich/OneloginSamlBundle from GitHub.

* Beginnen Sie für frühere Symfony-Versionen mit dem hslaovich/OneloginSamlBundle von 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:

Als nächstes fügen Sie die Standardkonfiguration hinzu. Wenn dieser Schritt übersprungen wird, funktioniert die Anwendung nicht ordnungsgemäß. Bearbeiten Sie die Datei config/packages/nbgrp_onelogin_saml.yaml wie folgt:

```yaml

„yaml

nbgrp_onelogin_saml:

nbgrp_onelogin_saml:

idp:

idp:

default:

Standard:

settings:

Einstellungen:

assertionConsumerService:

AssertionConsumerService:

url: '%env(SAML_ASSERTION_CONSUMER_SERVICE)%'

URL: '%env(SAML_ASSERTION_CONSUMER_SERVICE)%'

issuer: '%env(SAML_ISSUER)%'

Aussteller: '%env(SAML_ISSUER)%'

spEntityId: '%env(SAML_SP_ENTITY_ID)%'

spEntityId: '%env(SAML_SP_ENTITY_ID)%'

x509cert: '%env(SAML_X509_CERT)%'

x509cert: '%env(SAML_X509_CERT)%'

```

Update the config/packages/security.yaml file as well:

Aktualisieren Sie auch die Datei config/packages/security.yaml:

```yaml

„yaml

security:

Sicherheit:

encoders:

Encoder:

Symfony\Component\Security\Core\User\User: plaintext

Symfony\Component\Security\Core\User\User: Klartext

providers:

Anbieter:

saml:

saml:

nbgrp_onelogin_saml

nbgrp_onelogin_saml

firewalls:

Firewalls:

main:

hauptsächlich:

saml:

saml:

path: ^/saml

Pfad: ^/saml

provider: saml

Anbieter: saml

entry_point: nbgrp_onelogin_saml_entry_point

Eintragspunkt: nbgrp_onelogin_saml_entry_point

logout_entry_point: nbgrp_onelogin_saml_logout_entry_point

logout_entry_point: nbgrp_onelogin_saml_logout_entry_point

logout_success_handler: nbgrp_onelogin_saml_logout_success_handler

logout_success_handler: nbgrp_onelogin_saml_logout_success_handler

logout:

Ausloggen:

path: ^/logout$

Pfad: ^/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.

Das nbgrp/onelogin-saml-bundle verwendet Compilerpass, um die Konfiguration in einem von IDP indizierten Array in eine Registrierung einzufügen, die dann in der gesamten Anwendung verwendet wird. Wir überschreiben diese Funktionalität und laden die Konfiguration basierend auf dem Hostnamen dynamisch aus der Datenbank.

Create a new service in the api/config/services.yaml file:

Erstellen Sie einen neuen Dienst in der Datei api/config/services.yaml:

```yaml

„yaml

services:

Dienstleistungen:

app.saml_configuration_loader:

app.saml_configuration_loader:

class: App\Security\SamlConfigurationLoader

Klasse: App\Security\SamlConfigurationLoader

arguments:

Argumente:

- '@doctrine.orm.default_entity_manager'

- '@doctrine.orm.default_entity_manager'

```

Override relevant portions of the bundle:

Überschreiben Sie relevante Teile des Pakets:

Those files will be overridden to enable dynamic configuration of the login controller, metadata, and authenticator.

Diese Dateien werden überschrieben, um eine dynamische Konfiguration des Anmeldecontrollers, der Metadaten und des Authentifikators zu ermöglichen.

Login Controller

Login-Controller

Override the api/vendor/nbgrp/onelogin-saml-bundle/src/Controller/Login.php file to utilize our configuration.

Überschreiben Sie die Datei api/vendor/nbgrp/onelogin-saml-bundle/src/Controller/Login.php, um unsere Konfiguration zu verwenden.

In the __construct method, we autowire and add our service.

Bei der __construct-Methode verdrahten wir unseren Service automatisch und fügen ihn hinzu.

```php

```php

use App\Security\SamlConfigurationLoader;

verwenden Sie App\Security\SamlConfigurationLoader;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

verwenden Sie Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

use Symfony\Component\DependencyInjection\ContainerInterface;

verwenden Sie Symfony\Component\DependencyInjection\ContainerInterface;

use Symfony\Component\HttpFoundation\Request;

verwenden Sie Symfony\Component\HttpFoundation\Request;

use Symfony\Component\HttpFoundation\Response;

verwenden Sie Symfony\Component\HttpFoundation\Response;

use Symfony\Component\Routing\Annotation\Route;

verwenden Sie Symfony\Component\Routing\Annotation\Route;

use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

verwenden Sie Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class LoginController extends AbstractController

Die Klasse LoginController erweitert AbstractController

{

{

private $samlConfigurationLoader;

private $samlConfigurationLoader;

public function __construct(ContainerInterface $container, SamlConfigurationLoader $samlConfigurationLoader)

öffentliche Funktion __construct(ContainerInterface $container, SamlConfigurationLoader $samlConfigurationLoader)

{

{

parent::__construct($container);

parent::__construct($container);

$this->samlConfigurationLoader = $samlConfigurationLoader;

$this->samlConfigurationLoader = $samlConfigurationLoader;

}

}

*/

public function login(AuthenticationUtils $authenticationUtils, Request $request): Response

öffentliche Funktion login(AuthenticationUtils $authenticationUtils, Request $request): Antwort

{

{

$host = $request->server->get('HTTP_HOST');

$host = $request->server->get('HTTP_HOST');

$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);

$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);

// ...

// ...

}

}

}

}

```

Metadata

Metadaten

Line 19: Add our service.

Zeile 19: Fügen Sie unseren Service hinzu.

```php

```php

use App\Security\SamlConfigurationLoader;

verwenden Sie App\Security\SamlConfigurationLoader;

use Symfony\Component\DependencyInjection\ContainerInterface;

verwenden Sie Symfony\Component\DependencyInjection\ContainerInterface;

class MetadataController extends Controller

Die Klasse MetadataController erweitert Controller

{

{

public static function create(ContainerInterface $container): MetadataController

öffentliche statische Funktion create(ContainerInterface $container): MetadataController

{

{

$samlConfigurationLoader = $container->get(SamlConfigurationLoader::class);

$samlConfigurationLoader = $container->get(SamlConfigurationLoader::class);

return new self($samlConfigurationLoader);

return new self($samlConfigurationLoader);

}

}

public function __invoke(Request $request): Response

öffentliche Funktion __invoke(Request $request): Antwort

{

{

$host = $request->server->get('HTTP_HOST');

$host = $request->server->get('HTTP_HOST');

$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);

$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);

// ...

// ...

}

}

}

}

```

Haftungsausschluss:info@kdj.com

Die bereitgestellten Informationen stellen keine Handelsberatung dar. kdj.com übernimmt keine Verantwortung für Investitionen, die auf der Grundlage der in diesem Artikel bereitgestellten Informationen getätigt werden. Kryptowährungen sind sehr volatil und es wird dringend empfohlen, nach gründlicher Recherche mit Vorsicht zu investieren!

Wenn Sie glauben, dass der auf dieser Website verwendete Inhalt Ihr Urheberrecht verletzt, kontaktieren Sie uns bitte umgehend (info@kdj.com) und wir werden ihn umgehend löschen.

Weitere Artikel veröffentlicht am Jul 31, 2026