Hi,
I am trying to implement CSRF token for the form servlet, however I am getting error of "The import com.adobe.granite.csrf cannot be resolvedJava(268435846)" in the servlet.
I have added the dependency to the main pom.xml file:
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @BinaryAlchemy11,
Unfortunately, this com.adobe.granite.csrf package is not exported by any OSGi bundle. You can check it in via /system/console/depfinder and package or class name.
In the provided screenshot you can see that this bundle doesn't export desired package. That's why you can't import it in your bundle.
I'd suggest to create own implementation of CSRF service.
Best regards,
Kostiantyn Diachenko.
This is what I have in depfinder:
Do you have a sample example on creating own implementation of CSRF service?
Or the best practice to validate forms post request in servlet for CSRF attacks?
Views
Replies
Total Likes
As far as I know CSRF protection is enabled for forms by default.
Read this documentation:
In addition, you can check the following OSGi configurations that manage CSRF token:
- Adobe Granite CSRF Servlet
- Adobe Granite CSRF Filter
Best regards,
Kostiantyn Diachenko.
Thanks for the info. Do you have adobe documentation link where it mentions that AEM Forms uses CSRF Validation already?
Views
Replies
Total Likes
If you go in your local AEM server folder, in the /luanchpad/felix folder, then lookup for bundleXYZ, where XYZ is the ID of the bundle, which in you case is 245, you will find a bundle.jar file. If you look inside the jar, you will see 3 classes:
If these are what you are looking for ? I don't see any com.adobe.granite.csrf.CSRFService.
Oh okay that makes sense. Do you have an example of how you might have used CSRF validation for the form servlet?
Views
Replies
Total Likes
@BinaryAlchemy11 Did you find the suggestion helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies