|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
내 SaaS 애플리케이션의 경우 고객별로 SAML 구성을 구성하고 싶습니다. 고객의 필요에 맞게 Symfony One 로그인 번들의 구성을 변경할 수 있기를 원합니다.

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 로그인 번들의 구성을 조정해야 합니다.
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
``yaml
nbgrp_onelogin_saml:
nbgrp_onelogin_saml:
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
``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
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
``yaml
services:
서비스:
app.saml_configuration_loader:
app.saml_configuration_loader:
class: App\Security\SamlConfigurationLoader
클래스: 앱\보안\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);
parent::__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
공개 정적 함수 생성(ContainerInterface $container): MetadataController
{
{
$samlConfigurationLoader = $container->get(SamlConfigurationLoader::class);
$samlConfigurationLoader = $container->get(SamlConfigurationLoader::class);
return new self($samlConfigurationLoader);
새로운 self($samlConfigurationLoader)를 반환합니다.
}
}
public function __invoke(Request $request): Response
공개 함수 __invoke($request 요청): 응답
{
{
$host = $request->server->get('HTTP_HOST');
$host = $request->server->get('HTTP_HOST');
$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);
$samlSettings = $this->samlConfigurationLoader->getSettingsFromHost($host);
// ...
// ...
}
}
}
}
```
````
부인 성명:info@kdj.com
제공된 정보는 거래 조언이 아닙니다. kdj.com은 이 기사에 제공된 정보를 기반으로 이루어진 투자에 대해 어떠한 책임도 지지 않습니다. 암호화폐는 변동성이 매우 높으므로 철저한 조사 후 신중하게 투자하는 것이 좋습니다!
본 웹사이트에 사용된 내용이 귀하의 저작권을 침해한다고 판단되는 경우, 즉시 당사(info@kdj.com)로 연락주시면 즉시 삭제하도록 하겠습니다.

































