-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Workflow] There are no tokens available for workflow "%s" (new security system) #39505
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
Comments
This is a bit weird, since you are not using an expression here. Anyway, I must work on this one 👍🏼 |
I searched why and it's because i have a transition |
@wouterj Hi, I have a question for you here. We use the voter feature in the workflow, and previously there was an anon token. I always wanted to NOT use a anon token if the token storage was empty here to not hide a security hole. I'm preparing a PR to mitigate this, but the PR goes the previous principle: I use a So my question is why don't you use a NullToken when the user is not connected? And another question: is there a better fix for this issue? |
Hi! First of all: Sorry, I didn't realize that Workflow had an integration for the Security system, so we haven't thought about this at all during the refactoring.
Any token in the new system is authenticated and represents a user. We argued that an unauthenticated session is the same as an anonymously authenticated session (in both cases, no authentication happened and we must assume that the visitor has no roles).
I would say: Not throw the exception and handle the case where there is no token as "no roles". All expressions of security ( Btw, is there a reason the workflow doesn't use the expression features of the |
No problem, don't worry :)
When I implemented the guard feature in the workflow component, I duplicated the code from https://github.com/symfony/symfony/blob/5.x/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php I might re-use the ExpressionVoter instead, but now it's too late I think, since we had more available expression like |
Faced the same problem today - as soon as one of the transitions uses a guard, and you want to call any other (guard less) transistion via console command for example you get the error. |
…system (lyrixx) This PR was merged into the 5.2 branch. Discussion ---------- [Worflow] Fixed GuardListener when using the new Security system | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #39505 | License | MIT | Doc PR | Commits ------- bd26a79 [Worflow] Fixed GuardListener when using the new Security system
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 5.2.0
Description
After migration to the new security system, it looks that it's not possible anymore to apply transition as an anonymous because no token is available (previously we had the AnonymousToken).
How to reproduce
Use the new security system.
Had a workflow like:
Apply transition
pending_activation_to_enabled
as anonymous.Possible Solution
Support null token in:
https://github.com/symfony/workflow/blob/5.x/EventListener/GuardListener.php#L80
Additional context
User registers and his account is marked as pending_activation.
When he clicks email link to activate account, i used to apply transition pending_activation_to_enabled and then redirect user to the login page.
The text was updated successfully, but these errors were encountered: