ldaptools-bundle icon indicating copy to clipboard operation
ldaptools-bundle copied to clipboard

Symfony 5

Open mleko64 opened this issue 5 years ago • 17 comments

Do you plan to support symfony 5?

mleko64 avatar Dec 02 '19 09:12 mleko64

@mleko64 I have tried to make ldap-bundle compatible with Symfony 5. https://github.com/SebDev94/ldaptools-bundle/tree/symfony-5

Unfortunately, I don't know much about the tests. The authentication worked and I was able to select users.

SebDev94 avatar Mar 10 '20 07:03 SebDev94

Hi,

How are things going with this? Any help needed?

ilukac avatar May 20 '20 11:05 ilukac

Unfortunately I have no experience how to change the test cases correctly and then execute them.

The main change is a breakpoint in TreeBuilder (https://github.com/SebDev94/ldaptools-bundle/commit/16a63bd70a9d5142467a98aa13bfef561dc07921).

I also changed the events, but I'm not sure if this is correct. (https://github.com/SebDev94/ldaptools-bundle/commit/5aa89f973c1012359c5a5883663034dacde4c5c9)

I have been using my change since the beginning of the year and have had no problems so far

SebDev94 avatar May 21 '20 12:05 SebDev94

Which test cases?

I just composed your symfony-5 branch and will test it a bit. So far I didn't find any problem.

ilukac avatar May 21 '20 14:05 ilukac

Aren't those tests in the "spec" folder? For example: LdapAuthenticationProviderSpec.php

Thanks for the feedback. That's good to know.

SebDev94 avatar May 23 '20 11:05 SebDev94

Ah, I was looking for "tests" folder :)

Anyway, I wanted to check it out, but can't compose the bundle. The updated version of composer.json hangs composer when installing (gets into endless loop). Did you experience this as well?

ilukac avatar May 25 '20 10:05 ilukac

strangely enough, I had no problem with it. My composer.json in my projects look like this:

"repositories": [
    {
        "type": "vcs",
         "url": "https://github.com/SebDev94/ldaptools-bundle"
    }
],
"require": {
    "ldaptools/ldaptools-bundle": "dev-symfony-5",
    ....
}

Maybe we should take Symfony version 2.7 out. I don't know how far backward compatible that can be.

SebDev94 avatar May 26 '20 13:05 SebDev94

I did the same in my project demo and it works fine.

Problem was when I wanted to run composer in your repo so I can run phpspec...

ilukac avatar May 26 '20 14:05 ilukac

Hey @SebDev94 could do you submit a pull request please !

ahmed-bhs avatar Sep 17 '20 14:09 ahmed-bhs

Hi @ahmed-bhs, sorry for the late reply. I have created a PR.

SebDev94 avatar Dec 20 '20 13:12 SebDev94

i can't compose the Bundle in my Symfony 5.1 App , i got this Problem 1 - Root composer.json requires ldaptools/ldaptools-bundle ^0.9.2 -> satisfiable by ldaptools/ldaptools-bundle[0.9.2]. - ldaptools/ldaptools-bundle 0.9.2 requires symfony/framework-bundle ~2.7|~3.0|~4.0 -> found symfony/framework-bundle[v2.7.0, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.19] but it conflicts with your root composer.json require (5.1.*).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions

According to @SebDev94 the bundle shouldworks correctly with Symonfy 5 what shouldi do ?

ramieita avatar Feb 02 '21 12:02 ramieita

Hi @ramieita , the pull request from SebDev94 is not yet merged. If you want to use this bundle with Symfony 5, then you have to specify the respository of SebDev94 with the branch "dev-symfony-5" in your composer.json. Or you fork this repo (or SebDev94) on your own and include this in your composer.json (see https://getcomposer.org/doc/05-repositories.md#vcs)

See comment above:

"repositories": [
    {
        "type": "vcs",
         "url": "https://github.com/SebDev94/ldaptools-bundle"
    }
],
"require": {
    "ldaptools/ldaptools-bundle": "dev-symfony-5",
    ....
}
`
``

HelloSebastian avatar Feb 02 '21 13:02 HelloSebastian

Hi @HelloSebastian

after long Debug i found out the mistake class symfony/Security/LdapGuardAuthenticator.php https://github.com/SebDev94/ldaptools-bundle/blob/symfony-5/Security/LdapGuardAuthenticator.php // line 215

$token = new UsernamePasswordToken($user, $credentials['password'], 'ldap-tools', $user->getRoles()); $token->setAttribute('ldap_domain', $credDomain); $this->dispatcher->dispatch( new LdapLoginEvent($user, $token), LdapLoginEvent::SUCCESS, // my mistak is the comma ); just deleted the comma

ramieita avatar Feb 02 '21 19:02 ramieita

Wow, well seen! Thank you! Very weird that no error ever happened in my case. I fix this with https://github.com/SebDev94/ldaptools-bundle/commit/68c9f0898e86fe05d46d279dfcd0a9faaa02dac3.

HelloSebastian avatar Feb 02 '21 20:02 HelloSebastian

Apologies for such a late reply on this. I have done very little development on this bundle, or LdapTools, in quite some time. I have been focused on other things. I see that the PR was created . Though tests are definitely an issue at the moment. Let me see if I can make any progress on this over the weekend. Ideally I would like to:

  • Change the CI to work on Github Actions, and fix any tests.
  • Remove support for anything older than Symfony 4.4 (older tagged versions would need to be used if on something older)
  • Remove the old bc layer stuff.

However, there might be some issues with that. The user in this library uses the AdvancedUserInterface, which doesn't even exist in 5.0, but does exist in all previous versions. So I'm not sure what to do with that.

ChadSikorra avatar Feb 05 '21 01:02 ChadSikorra

However, there might be some issues with that. The user in this library uses the AdvancedUserInterface, which doesn't even exist in 5.0, but does exist in all previous versions. So I'm not sure what to do with that.

I noticed that too. This was deprecated in 4.1 with a recommendation on migrating this to a custom user checker.

Whilst I'll miss it I do kind of agree that user security beyond the basics is better left to the application domain. Having worked with clients of differing sizes (from start-up to FTSE100) they all have differing requirements on security. Only the larger organisations ever ask us about expiring user accounts/passwords after a certain period mandating a change, to work in line with their own I.T. policies. I'm happy to have that as project specific.

I wouldn't object to this bundle offering its own user checker, though given that different directory backends have different ways of disabling accounts for example, it wouldn't be fair to expect this bundle to cater for every different directory.

Adambean avatar Mar 12 '21 22:03 Adambean

How are things going here? Any help needed?

ilukac avatar Jun 23 '21 12:06 ilukac