承接 surfnet/stepup-saml-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

surfnet/stepup-saml-bundle

Composer 安装命令:

composer require surfnet/stepup-saml-bundle

包简介

A Symfony 7 bundle that integrates the simplesamlphp\saml2 library with Symfony.

README 文档

README

A PHP Symfony bundle that adds SAML capabilities to your application using simplesamlphp/saml2

Developed as part of the OpenConext-Stepup Gateway and related OpenConext-Stepup applications that use SAML 2.0

Installation

  • Add the package to your Composer file
    composer require surfnet/stepup-saml-bundle

How to install with SF6

  1. Require the bundle in the composer.json (version 4.1.9 or higher)
  2. Enable the bundle in config/bundles.php add to the return statement: Surfnet\SamlBundle\SurfnetSamlBundle::class => ['all' => true],
  3. Specify the bundle configuration in config/packages/surfnet_saml.yaml, consult the configuration section below for available options.
  4. Configure the templates to the Twig Bundle by adding '%kernel.project_dir%/vendor/surfnet/stepup-saml-bundle/templates': 'SurfnetSaml' to your twig.yaml config file(s)

Configuration

surfnet_saml:
    enable_authentication: false
    hosted:
        attribute_dictionary:
            ignore_unknown_attributes: false
        service_provider:
            enabled: true
            assertion_consumer_route: name_of_the_route_of_the_assertion_consumer_url
            public_key: %surfnet_saml_sp_publickey%
            private_key: %surfnet_saml_sp_privatekey%
        identity_provider:
            enabled: true
            service_provider_repository: service.name.of.entity_repository
            sso_route: name_of_the_route_of_the_single_sign_on_url
            public_key: %surfnet_saml_idp_publickey%
            private_key: %surfnet_saml_idp_privatekey%
        metadata:
            entity_id_route: name_of_the_route_of_metadata_url
            public_key: %surfnet_saml_metadata_publickey%
            private_key: %surfnet_saml_metadata_privatekey%
    remote:
        identity_provider:
            enabled: true
            entity_id: %surfnet_saml_remote_idp_entity_id%
            sso_url: %surfnet_saml_remote_idp_sso_url%
            certificate: %surfnet_saml_remote_idp_certificate%
        service_providers:
            - entity_id: "%surfnet_saml_remote_sp_entity_id%"
              certificate_file: "%surfnet_saml_remote_sp_certificate%"
              assertion_consumer_service_url: "%surfnet_saml_remote_sp_acs%"            

The hosted: configuration lists the configuration for the services (SP, IdP or both) that your application offers. SP and IdP functionality can be turned off and on individually through the repective enabled flags.

The remote: configuration lists, if enabled, the configuration for one or more remote service providers and identity providers to connect to. If your application authenticates with a single identity provider, you can use the identity_provider: option as shown above. The identity provider can be accessed runtime using the @surfnet_saml.remote.idp service.

If your application authenticates with more than one identity providers, you can omit the identity_provider: key from configuration and list all identity providers under identity_providers:. The identity providers can be accessed by using the @surfnet_saml.remote.identity_providers service.

    remote:
        identity_providers:
            -  enabled: true
               entity_id: %surfnet_saml_remote_idp_entity_id%
               sso_url: %surfnet_saml_remote_idp_sso_url%
               certificate: %surfnet_saml_remote_idp_certificate%

The inlined certificate in the last line can be replaced with certificate_file containing a filesystem path to a file which contains said certificate. It is recommended to use parameters as listed above. The various publickey and privatekey variables are the contents of the key in a single line, without the certificate etc. delimiters. The use of parameters as listed above is highly recommended so that the actual key contents can be kept out of the configuration files (using for instance a local parameters.yml file).

The service_provider_repository is a repository of service providers for which you offer IdP services. The service configured must implement the Surfnet\SamlBundle\Entity\ServiceProviderRepository interface.

Service providers can be provided statically by using the remote.service_providers configuration option. To use these configured service providers keep in mind that you need to assign surfnet_saml.remote.service_providers as service_provider_repository.

Example Usage

Symfony Authentication

As of version 5 of this bundle, we started supporting SAML authentications via the Stepup SAML bundle. This ties into the Symfony Security component.

Details about how to install this into your SP, see the EXAMPLES.md.

Overriding the ACS processor

Your application will start to try and handle all SAML Responses that are posted to your apps ACS location. In most situations that's exactly what you want. However if you want to handle the response yourself. You can!

  1. Ensure you add a RelayState statement to the AuthnRequest
  2. Configure that RelayState value in the rejected_relay_states parameter (in your app). This value defaults to []. So be sure to pass an array of string values
  3. Thats it.

Metadata Publishing

<?php

namespace Acme\SamlBundle

use Surfnet\SamlBundle\Http\XMLResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class MetadataController extends Controller
{
    public function metadataAction(Request $request)
    {
        /** @var \Surfnet\SamlBundle\Metadata\MetadataFactory $metadataFactory */
        $metadataFactory = $this->get('surfnet_saml.metadata_factory');

        return new XMLResponse($metadataFactory->generate());
    }
}

See more examples in EXAMPLES.md.

Release strategy

CHANGELOG.md

Please read: https://github.com/OpenConext/Stepup-Deploy/wiki/Release-Management for more information on the release strategy used in Stepup projects.

UPGRADING.md

When introducing backwards compatible breaking changes in the bundle. Please update the UPGRADING.md file to instruct users how to deal with these changes. This makes upgrading as painless as possible.

surfnet/stepup-saml-bundle 适用场景与选型建议

surfnet/stepup-saml-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 105.75k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2014 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「saml」 「SAML2」 「simplesamlphp」 「surfnet」 「stepup」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 surfnet/stepup-saml-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 surfnet/stepup-saml-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 surfnet/stepup-saml-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 105.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 21
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 14
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2014-11-06