Home > front end >  Problem with [Authenticate] filter and Validator execute priority
Problem with [Authenticate] filter and Validator execute priority

Time:03-25

Good Day,

I have validations with session values into a validator, if the session is expired, It has not been detected within the execution of the validator, and this validator responds with an error, a not real error.

How to change the priority of execution of [Authenticate] filter, so that the execution of this filter is before the validator.

CodePudding user response:

Note the [Authenticate] attribute is a request filter attribute which should be applied on the service implementation whilst all the declarative validation attributes should be applied on the Request DTO.

Since you’re already using validation attributes you should use the [ValidateIsAuthenticated] type validator to validate the user is authenticated.

  • Related