I am trying to do LDAP authentication, I currently have this type of error :
ServiceNotFoundException: The service
"security.firewall.map.context.main" has a dependency on a
non-existent service "form.csrf_provider".
Any help please ?
You need to enable csrf_protection in your configuration. Open config.yml and be sure that
framework:
csrf_protection: true
is present in your configuration.
The form.csrf_provider is deprecated and removed in Symfony 3.
Use security.csrf.token_manager instead.
My guess is that you are using a bundle that is not ready for symfony3.
Look at the README of your required bundles and to be sure they are compatibile.
See the 3.0 CHANGELOG for all deprecated features.
Update
It's the inverse. You are on a too old symfony version, which doesn't support the form.csrf_provider, and you are surely using a bundle that require it.
Look for adapt your requirements or your symfony version.
NOTE: You should really change your symfony version for a stable release.
Related
I have integrated symfony messenger bundle and i am trying to encode that message .
It was working in Symfony 3.4.4 version . However it is giving above error in Symfony 3.4.28 version.
I have traced in symfony serialzer component , it seems that jsonEncoder is not listing in serialzer.php and which is causing this issue.
What is the reason for excluding json encoder in symfony serializer component.
See below DoctrineTransportSender:
public function send(Envelope $envelope)
{
$encodedMessage = $this->encoder->encode($envelope);
}
//messenger configuration:
messenger:
transports:
# DSN: doctrine://$repository_alias/$queue_name
# most likely we do not need more repositories (unless there's a need for splitting MySQL table with messages)
main: "doctrine://default/test"
routing:
# message type to transport routes
Bundle\QueueBundle\Message\TestMessage: [ main ]
serializer:
enabled: true
Symfony Messenger switched to PHP's native serialization/deserialization by default. Using php serialization prevents problems, e.g. accidentally omitting properties from being serialized. It will also ensure the component can be used without Symfony Serializer, which is less of an issue with Symfony 3.4, but with Symfony 4 and Flex or when using the messenger outside of Symfony you would have to install this dependency manually leading to errors.
You can still use Symfony Serializer, but it has to be configured. Considering you are on Symfony 3.4 you will likely have to do this manually by providing an appropriate Serializer-instance to the TransportFactory, see:
https://github.com/symfony/symfony/blob/4.4/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1751-L1757
In Symfony 4 you can use the configuration instead, see:
https://symfony.com/doc/current/messenger.html#serializing-messages
Thanks for the response.
I have resolved above issue by adding customized serializer instead of calling messenger serializer(Which includes encoding as well decoding) and it works fine
In a Symfony 3.1 application (which developement has been started on Symfony 2.7) I have this config item in config_prod.yml:
framework:
validation:
cache: validator.mapping.cache.doctrine.apc
To use this setup with PHP7 I needed to change this to:
framework:
validation:
cache: validator.mapping.cache.doctrine.apcu
Since Symfony 3.1 there is as well a new Cache component which for the system is configured like:
framework:
cache:
system: ???
and the official blog article states for it:
"cache.system is where Symfony components store their contents (e.g. the Serializer and Validator metadata) (...) If your server has APCu installed, the cache.system pool uses it. Otherwise, it falls back to the filesystem cache."
What I'd like to understand is whether the framework->validation->cache definition is still required or if that's part of the cache.system pool.
In later case - if I understand it correctly - framework->validation->cache could be removed and still an enabled APCu would cache validation annotations.
EDIT
If my assumption is correct then validations would be cached by the new Symfony ApcuAdapter and not by the Doctrine APC/U Cache anymore.
Based on the upgrade documentation:
"The framework.serializer.cache option and the service serializer.mapping.cache.apc have been deprecated. APCu should now be automatically used when available."
So this means indeed the old configuration can be deleted without any replacement as long as apcu is installed and enabled.
the Symfony2 service SecurityContext is deprecated since version 2.6. In a current project under developpment we frequently use user roles. Therefore, it make senses to
switch immediately to the new security services of 2.6.
On the other hand we use FOSUserBundle in the project as well. As far as I see, the latest version of this bundle is at the level of Symfony 2.3. Since in the dev-environment version 2.6 ist not 100% bc with 2.3 (for example if Xdebug is acivated) the usasge of the new services yields conflicts ...
Our questions:
does someone know whether the FOSUserBundle will be compatible wih 2.6 in the near future?
has someone encountered the same problem and can give hints to handle it?
Best wishes
The problem has been solved.
First of all it turned out that all the Deprecated-errors - which prevented a development in our current envirement/configuration - came from a Symfony 2.7-dev version.
It seems that Symfony 2.6 itself does not have such errors. In this sense the above comments were correct. Thus, for the moment one has to use Symfony 2.6 in order to rewrite the own app such that the usage of security aspects becomes compatible with version 2.6.
From a FOS-developer we got the feedback that there will be an 2.6 compatible update of the user bundle before the release of a stable Symfony 2.7 vesion. Therefor one can switch smoothly form 2.6 to 2.7.
At the moment, the Hibernate Validator has released the latest version as 4.3.0.Final here. I have tried to upgrade it to my Glassfish 3.1.2 as the following step: -
1. Remove the GLASSFISH/glassfish/modules/bean-validator.jar
2. Copying the hibernate-validator-4.3.0.Final.jar to GLASSFISH/glassfish/modules
3. Restart the Glassfish
4. The Glassfish cannot start. It seems hang.
After searching via the Google, I've found that the file named "bean-validator.jar" was created by the Glassfish team as an OSGi version. Sadly, I cannot find how to create it. Could you please help to advise further? Thank you very much for your help in advance. I'm looking forward to hearing from you soon.
A (slightly outdated) description of how to build Glassfish's bean-validator.jar can be found here.
What's needed in general is an OSGi bundle which includes Hibernate Validator itself and the Bean Validation API. With this bundle you should be able to replace the original bean-validator.jar. Additionally you need the JBoss Logging bundle, which is used since release 4.3 by Hibernate Validator as logging API and already comes in form of an OSGi bundle.
If you're building a web application, you could also package HV 4.3 within your WAR and turn off class loader delegation by providing the file WEB-INF/glassfish-web.xml with the following contents:
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<class-loader delegate="false" />
</glassfish-web-app>
That way the HV classes will be loaded from your application instead of from the module provided by Glassfish.
You might also be interested in the issue GLASSFISH-15648 which aims to provide a dedicated Glassfish update package for HV.
As my case was ear, rather than war, based on suggestion of Gunnar, I did a patched version of the module, that is deployable to Glassfish (My version is 3.1.1 OSE).
Someone might find it still useful, see my blog for my solution (including step-by-step approach): http://peter-butkovic.blogspot.de/2012/11/glassfish-311-oss-with-hibernate.html
I have been trying to follow this example from propel to configure a custom security provider
http://www.propelorm.org/cookbook/symfony2/the-symfony2-security-component-and-propel.html
however I always get this error
ServiceNotFoundException: The service "security.authentication.manager" has a dependency on a non-existent service "acme.secured.security.provider"
It appears not to be loading the services.xml but I cannot be sure. Has anyone else come across a similar issue? Im new to symfony2, can anyone suggest the best place to start debugging this?
So import it. In your app/config.yml:
imports:
acme_bundle:
resource: "#AcmeSecuredBundle/Resources/config/services.xml"
You can read more about importing services in the documentation.