druidfi / simplesamlphp-bundle

此包已被废弃,不再维护。作者建议使用https://github.com/nbgrp/onelogin-saml-bundle包。

为SimpleSAMLphp提供与Symfony全栈框架的紧密集成

安装: 364

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 3

分支: 0

开放问题: 2

类型:symfony-bundle

0.1.1 2021-10-28 04:34 UTC

This package is auto-updated.

Last update: 2023-11-14 06:22:34 UTC


README

使用SimpleSAMLphp登录到Symfony应用程序。

安装

使用以下命令安装包:

composer require -W druidfi/simplesamlphp-bundle:dev-main

config/packages/security.yaml中配置安全组件

security:
    # https://symfony.ac.cn/doc/current/security/experimental_authenticators.html
    enable_authenticator_manager: true
    # https://symfony.ac.cn/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        druidfi_simplesamlphp_user_provider:
            id: Druidfi\SimpleSamlPhpBundle\Security\UserProvider
    firewalls:
        main:
            provider: druidfi_simplesamlphp_user_provider

            # activate different ways to authenticate
            # https://symfony.ac.cn/doc/current/security.html#firewalls-authentication
            custom_authenticators:
                - Druidfi\SimpleSamlPhpBundle\Security\SamlAuthenticator
            logout:
                path: druidfi_simplesamlphp_logout
                target: /

    # Easy way to control access for large sections of your site
    # Note: Only the *first* access control that matches will be used
    access_control:
        - { path: '^/login', roles: ROLE_USER }
        # This must be last one
        - { path: '^/', roles: IS_AUTHENTICATED_ANONYMOUSLY }

将路由添加到config/routes.yaml

###> druidfi/simplesamlphp-bundle ###
druidfi_simplesamlphp_login:
  path: /login
  controller: Druidfi\SimpleSamlPhpBundle\Controller\LoginController::login
druidfi_simplesamlphp_logout:
  path: /logout
  controller: Druidfi\SimpleSamlPhpBundle\Controller\LoginController::logout
###< druidfi/simplesamlphp-bundle ###

许可证

此包采用MIT许可证。有关更多信息,请参阅包中的完整LICENSE文件。

其他信息

您可以从Packagist找到此项目:https://packagist.org.cn/packages/druidfi/simplesamlphp-bundle