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

Missing request anti forgery token #327

Conversation

alejoroman0605
Copy link
Contributor

Related to Issue #316

Description

In this PR, modifications were made to the SPA module template configurations to enable the use of the Anti-Forgery Token when making API calls from a controller in SPA modules. This ensures that such calls work correctly even when not logged in or when the search box is not present in the interface, avoiding the 404 - Unauthorized error. The access levels of the SecurityAccessLevel.Edit methods were adjusted to SecurityAccessLevel.View by default, although this value can be modified according to development requirements. Additionally, the [ValidateAntiForgeryToken] and [AntiForgeryToken:true] attributes were added to the corresponding methods and views, allowing API calls to succeed when "All Users" permissions are granted in the DNN configurations. This avoids 404 errors.

How Has This Been Tested?

I created a new Layout without the search box present in the skin to assign it to the test pages.
And I tested locally the SPA modules Vue2, Vue3, ReactJs and Angular to which I made the modifications.
I checked the pages that were allowed for all users without being logged in, and they worked correctly.

Screenshots (if appropriate):

Error
image

Fixed
image
image
image
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@WillStrohl WillStrohl added the bug Something isn't working label Nov 18, 2024
@WillStrohl WillStrohl added this to the 01.13.01 milestone Nov 18, 2024
Copy link
Contributor

@WillStrohl WillStrohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@WillStrohl WillStrohl merged commit e2f590c into UpendoVentures:master Nov 18, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants