Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove guard related service definitions when authenticator manager is enabled. #879

Closed
chalasr opened this issue Jun 20, 2021 · 13 comments · Fixed by #886
Closed

Remove guard related service definitions when authenticator manager is enabled. #879

chalasr opened this issue Jun 20, 2021 · 13 comments · Fixed by #886

Comments

@chalasr
Copy link
Collaborator

chalasr commented Jun 20, 2021

No description provided.

@jzecca
Copy link

jzecca commented Jun 25, 2021

I get this deprecation notice after migrating to the new authentication system:

1x: The "Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator"
    class implements "Symfony\Component\Security\Guard\AuthenticatorInterface"
    that is deprecated since Symfony 5.3, use the new authenticator system instead.

The deprecation only shows the first time I run my tests (or after running bin/console cache:clear -e test).
I'm not using anything Guard-related in my app anymore and am using the new JWTAuthenticator.

Could it be related to this issue?

@chalasr
Copy link
Collaborator Author

chalasr commented Jun 28, 2021

@jzecca I think so, yes. I'm looking at it.

@asumkin
Copy link

asumkin commented Jul 5, 2021

I still get deprecation message after composer upgrade

Remaining indirect deprecation notices (1)

1x: The "Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator" class implements "Symfony\Component\Security\Guard\AuthenticatorInterface" that is deprecated since Symfony 5.3, use the new authenticator system instead.

@chalasr
Copy link
Collaborator Author

chalasr commented Jul 5, 2021

Did you also upgrade your security config to use the new authenticator instead of Guard?

@asumkin
Copy link

asumkin commented Jul 5, 2021

You meant this

api:
            pattern:   ^/api
            stateless: true
            custom_authenticators:
                - lexik_jwt_authentication.jwt_token_authenticator

?

@chalasr
Copy link
Collaborator Author

chalasr commented Jul 5, 2021

Nope, I mean:

api:
            pattern:   ^/api
            stateless: true
            jwt: ~

As documented and mentioned in https://github.com/lexik/LexikJWTAuthenticationBundle/blob/2.x/UPGRADE-2.12.md.

@asumkin
Copy link

asumkin commented Jul 5, 2021

Yep.

I tried both.

Now

        api:
            pattern:   ^/api
            jwt: ~


and result the same

bash-3.2$ php bin/phpunit
PHPUnit 9.5.6 by Sebastian Bergmann and contributors.

Testing
.                                                                   1 / 1 (100%)

Time: 00:01.020, Memory: 66.50 MB

OK (1 test, 1 assertion)

Remaining indirect deprecation notices (1)

  1x: The "Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator" class implements "Symfony\Component\Security\Guard\AuthenticatorInterface" that is deprecated since Symfony 5.3, use the new authenticator system instead.
    1x in BrandsResourceTest::testCreateBrand from App\Tests\Functional



@chalasr
Copy link
Collaborator Author

chalasr commented Jul 5, 2021

Please create a small application with enough code to reproduce. I can’t reproduce on my side and our functional test suite does not suffer from this issue.

@bizley
Copy link

bizley commented Jul 5, 2021

Most probably you have JWTTokenAuthenticator used in that test (BrandsResourceTest::testCreateBrand), maybe mock? This triggers the notice.

@asumkin
Copy link

asumkin commented Jul 5, 2021

I found it.

var/cahe directory was not empty after clearing cache (bin/console cache:clear --env=test)

After I manually removed all file and restart tests - deprecations message gone.
It seems to me was an Symfony old bug related to it ....

@HolgerBanse
Copy link

I upgraded to v2.12.2, adapted the security config as mentioned above and get the same deprecation message in a unit test that extends KernelTestCase and does not directly use or test anything related to the JWTAuthenticationBundle.
I cleared cache, checked for usages of JWTTokenAuthenticator, but the deprecation remains.

What else can I check or did I miss maybe?

@chalasr
Copy link
Collaborator Author

chalasr commented Jul 6, 2021

Please create a small application with enough code to reproduce. I can’t reproduce on my side and our functional test suite does not suffer from this issue.

Commenting on closed/merged tickets as it hijacks the discussion.
Consider asking on support platforms or creating a new issue if you think you found a bug, I won't reply anymore here.
Thanks for your understanding.

@asumkin
Copy link

asumkin commented Jul 6, 2021

I upgraded to v2.12.2, adapted the security config as mentioned above and get the same deprecation message in a unit test that extends KernelTestCase and does not directly use or test anything related to the JWTAuthenticationBundle.
I cleared cache, checked for usages of JWTTokenAuthenticator, but the deprecation remains.

What else can I check or did I miss maybe?

Try my case.

rm -rf var/cache/test/*
bin/console cache:clear --env=test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants