時価総額: $2.1862T -0.10%
ボリューム(24時間): $65.0919B 2.38%
  • 時価総額: $2.1862T -0.10%
  • ボリューム(24時間): $65.0919B 2.38%
  • 恐怖と貪欲の指数:
  • 時価総額: $2.1862T -0.10%
暗号
トピック
暗号化
ニュース
暗号造園
動画
トップニュース
暗号
トピック
暗号化
ニュース
暗号造園
動画
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%

暗号通貨のニュース記事

SaaS アプリケーションに対して顧客ごとに SAML 構成を構成する方法

2024/05/27 05:03

私の SaaS アプリケーションでは、顧客ごとに SAML 構成を構成したいと考えています。顧客のニーズに合わせて Symfony One ログイン バンドルの設定を変更できるようにしたいと考えています。

SaaS アプリケーションに対して顧客ごとに SAML 構成を構成する方法

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.

このガイドは、顧客ごとに Symfony アプリケーションの SAML SSO を設定するのに役立ちます。各顧客の特定の要件に合わせて、Symfony One Login Bundle の構成を調整する必要があります。

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

まず、Symfony のバージョンに基づいて適切なバンドルを決定します。

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

* Symfony 6 の場合は、GitHub から nbgrp/onelogin-saml-bundle をインストールします。

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

* 以前の Symfony バージョンの場合は、GitHub の hslaovich/OneloginSamlBundle から始めます。

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:

次に、デフォルトの構成を追加します。この手順をスキップすると、アプリケーションは正しく機能しなくなります。 config/packages/nbgrp_onelogin_saml.yaml ファイルを次のように編集します。

```yaml

```ヤムル

nbgrp_onelogin_saml:

nbgrp_onelogin_saml:

idp:

IDP:

default:

デフォルト:

settings:

設定:

assertionConsumerService:

アサーションコンシューマサービス:

url: '%env(SAML_ASSERTION_CONSUMER_SERVICE)%'

URL: '%env(SAML_ASSERTION_CONSUMER_SERVICE)%'

issuer: '%env(SAML_ISSUER)%'

発行者: '%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:

config/packages/security.yaml ファイルも更新します。

```yaml

```ヤムル

security:

安全:

encoders:

エンコーダ:

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

Symfony\Component\Security\Core\User\User: 平文

providers:

プロバイダー:

saml:

サムル:

nbgrp_onelogin_saml

nbgrp_onelogin_saml

firewalls:

ファイアウォール:

main:

主要:

saml:

サムル:

path: ^/saml

パス: ^/saml

provider: saml

プロバイダー: saml

entry_point: nbgrp_onelogin_saml_entry_point

エントリポイント: 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:

ログアウト:

path: ^/logout$

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

nbgrp/onelogin-saml-bundle はコンパイラパスを利用して、idp でインデックス付けされた配列内のレジストリに構成を挿入し、その後アプリケーション全体で使用されます。この機能をオーバーライドし、ホスト名に基づいてデータベースから構成を動的に読み込みます。

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

api/config/services.yaml ファイルに新しいサービスを作成します。

```yaml

```ヤムル

services:

サービス:

app.saml_configuration_loader:

app.saml_configuration_loader:

class: App\Security\SamlConfigurationLoader

クラス: App\Security\SamlConfigurationLoader

arguments:

引数:

- '@doctrine.orm.default_entity_manager'

- 「@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.

api/vendor/nbgrp/onelogin-saml-bundle/src/Controller/Login.php ファイルをオーバーライドして、構成を利用します。

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

__construct メソッドでは、サービスを自動配線して追加します。

```php

```php

use App\Security\SamlConfigurationLoader;

App\Security\SamlConfigurationLoader を使用します。

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

Symfony\Bundle\FrameworkBundle\Controller\AbstractController を使用します。

use Symfony\Component\DependencyInjection\ContainerInterface;

Symfony\Component\DependencyInjection\ContainerInterface を使用します。

use Symfony\Component\HttpFoundation\Request;

Symfony\Component\HttpFoundation\Request を使用します。

use Symfony\Component\HttpFoundation\Response;

Symfony\Component\HttpFoundation\Response を使用します。

use Symfony\Component\Routing\Annotation\Route;

Symfony\Component\Routing\Annotation\Route を使用します。

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

Symfony\Component\Security\Http\Authentication\AuthenticationUtils を使用します。

class LoginController extends AbstractController

クラス LoginController は AbstractController を拡張します

{

{

private $samlConfigurationLoader;

プライベート$samlConfigurationLoader;

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

パブリック関数 __construct(ContainerInterface $container, SamlConfigurationLoader $samlConfigurationLoader)

{

{

parent::__construct($container);

親::__construct($container);

$this->samlConfigurationLoader = $samlConfigurationLoader;

$this->samlConfigurationLoader = $samlConfigurationLoader;

}

}

*/

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

パブリック関数ログイン(AuthenticationUtils $authenticationUtils, リクエスト $request): 応答

{

{

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

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

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

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

// ...

// ...

}

}

}

}

```

「」

Metadata

Metadata

Line 19: Add our service.

19 行目: サービスを追加します。

```php

```php

use App\Security\SamlConfigurationLoader;

App\Security\SamlConfigurationLoader を使用します。

use Symfony\Component\DependencyInjection\ContainerInterface;

Symfony\Component\DependencyInjection\ContainerInterface を使用します。

class MetadataController extends Controller

クラス MetadataController はコントローラーを拡張します

{

{

public static function create(ContainerInterface $container): MetadataController

パブリック静的関数 create(ContainerInterface $container): MetadataController

{

{

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

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

return new self($samlConfigurationLoader);

新しい自己を返します($samlConfigurationLoader);

}

}

public function __invoke(Request $request): Response

パブリック関数 __invoke(Request $request): 応答

{

{

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

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

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

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

// ...

// ...

}

}

}

}

```

「」

オリジナルソース:e69a662db73f4c7002904d90a1070cce

免責事項:info@kdj.com

提供される情報は取引に関するアドバイスではありません。 kdj.com は、この記事で提供される情報に基づいて行われた投資に対して一切の責任を負いません。暗号通貨は変動性が高いため、十分な調査を行った上で慎重に投資することを強くお勧めします。

このウェブサイトで使用されているコンテンツが著作権を侵害していると思われる場合は、直ちに当社 (info@kdj.com) までご連絡ください。速やかに削除させていただきます。

2026年07月31日 に掲載されたその他の記事