nextcloud / nextcloud/user_saml

SAML to MS Azure does not work with version 5.0.2

Open
#634 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug regression
Dominant language
PHP
Stars
104
Forks
85
Avg merge
1d 15h
Merged PRs (30d)
16

Description

I can also confirm that the login by SAML to MS Azure does not work with version 5.0.2 (NC = 24.0.2). Here the log output which orrurs when I try it:

{
  "reqId": "h9UXc9Ah3BCbjwhP3BE3",
  "level": 3,
  "time": "2022-06-23T12:13:20+02:00",
  "remoteAddr": "192.168.1.1",
  "user": "--",
  "app": "index",
  "method": "GET",
  "url": "/apps/user_saml/saml/login?originalUrl=&requesttoken=****token-removed****&idp=2",
  "message": "Invalid array settings: idp_entityId_not_found, idp_sso_not_found, idp_cert_or_fingerprint_not_found_and_required",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",
  "version": "24.0.2.1",
  "exception": {
    "Exception": "OneLogin\\Saml2\\Error",
    "Message": "Invalid array settings: idp_entityId_not_found, idp_sso_not_found, idp_cert_or_fingerprint_not_found_and_required",
    "Code": 2,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/user_saml/3rdparty/vendor/onelogin/php-saml/src/Saml2/Auth.php",
        "line": 177,
        "function": "__construct",
        "class": "OneLogin\\Saml2\\Settings",
        "type": "->",
        "args": [
          [
            true,
            false,
            "https://nextcloud-test.domain.local/apps/user_saml/saml",
            [
              false,
              false,
              false,
              false,
              false,
              "And 9 more entries, set log level to debug to see all entries"
            ],
            [
              "https://nextcloud-test.domain.local/apps/user_saml/saml/metadata",
              [
                "https://nextcloud-test.domain.local/apps/user_saml/saml/acs"
              ],
              "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
              "",
              ""
            ],
            "And 1 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php",
        "line": 174,
        "function": "__construct",
        "class": "OneLogin\\Saml2\\Auth",
        "type": "->",
        "args": [
          [
            true,
            false,
            "https://nextcloud-test.domain.local/apps/user_saml/saml",
            [
              false,
              false,
              false,
              false,
              false,
              "And 9 more entries, set log level to debug to see all entries"
            ],
            [
              "https://nextcloud-test.domain.local/apps/user_saml/saml/metadata",
              [
                "https://nextcloud-test.domain.local/apps/user_saml/saml/acs"
              ],
              "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
              "",
              ""
            ],
            "And 1 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "login",
        "class": "OCA\\User_SAML\\Controller\\SAMLController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\User_SAML\\Controller\\SAMLController"
          },
          "login"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\User_SAML\\Controller\\SAMLController"
          },
          "login"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\User_SAML\\Controller\\SAMLController",
          "login",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          [
            "*** sensitive parameters replaced ***",
            "user_saml.SAML.login"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1023,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/user_saml/saml/login"
        ]
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/nextcloud/apps/user_saml/3rdparty/vendor/onelogin/php-saml/src/Saml2/Settings.php",
    "Line": 141,
    "CustomMessage": "--"
  }
}

Downgrading to 5.0.1 helps.

Originally posted by @brunt82 in https://github.com/nextcloud/user_saml/issues/630#issuecomment-1164252723

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apps/user_saml/lib/Controller/SAMLController.php around line 174 and trace the settings passed to the OneLogin SAML library, especially Settings.php line 141. Compare behavior between versions 5.0.1 and 5.0.2 and reproduce the SAML login against MS Azure. Done means version 5.0.2 no longer reports missing IdP settings and login succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.