hslavich / OneloginSamlBundle

OneLogin SAML Bundle for Symfony
MIT License
149 stars 94 forks source link

ERR_TOO_MANY_REDIRECTS: Symfony #210

Open rahulsharma841990 opened 6 months ago

rahulsharma841990 commented 6 months ago

I am trying to implement the Azure SAML IDP in my symfony application, i have used the package https://github.com/hslavich/OneloginSamlBundle and followed the instructions correctly, but now when i am trying to access the url saml/login its just redirecting multiple times on same url and after that showing Too many redirects error. Can anyone please tell me what i did wrong in this code?

Security.yml

` security:

encoders:
    App\Entity\User: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    db:
        entity:
            class: App\Entity\User
            property: username

firewalls:
    app:
        pattern: ^/
        saml:
            # Match SAML attribute 'uid' with username.
            # Uses getNameId() method by default.
            username_attribute: uid
            # Use the attribute's friendlyName instead of the name
            use_attribute_friendly_name: false
            check_path: saml_acs
            login_path: saml_login
        logout:
            path: saml_logout
access_control:
    - { path: ^/saml/login, roles: PUBLIC_ACCESS }
    - { path: ^/saml/metadata, roles: PUBLIC_ACCESS }
    - { path: ^/, roles: ROLE_USER }
    - { path: ^/api, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/, role: ROLE_USER }
    - { path: ^/import-export, role: ROLE_ADMIN }
    - { path: ^/user, role: ROLE_ADMIN }

`

hslavich_onelogin_saml.yml

hslavich_onelogin_saml: idp: entityId: 'https://login.microsoftonline.com/14124/v2.0' singleSignOnService: url: 'https://login.microsoftonline.com/1231/saml2' binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' x509cert: '-----BEGIN CERTIFICATE----- 12123 -----END CERTIFICATE-----' sp: entityId: 'http://lut.local/saml/metadata' assertionConsumerService: url: 'http://lut.local/saml/acs' binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' singleLogoutService: url: 'http://lut.local/saml/logout' binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'

using Symfony 5.4