implementation of Authentication using JWT. Security applied on all microservices endpoints.

This commit is contained in:
Reginald Cherenfant Jasmin
2023-09-20 00:32:30 -04:00
parent 8d386af40a
commit 77816605d1
75 changed files with 1744 additions and 219 deletions

View File

@ -4,9 +4,9 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface IAnswerServiceProvider
{
Task<List<Answer>> getAnswersAsync();
Task<List<Models.Answer>> GetAnswersByResponseIdAsync(int responseId);
Task<List<Answer>> getAnswersAsync(string token);
Task<List<Models.Answer>> GetAnswersByResponseIdAsync(int responseId, string token);
Task<Models.Answer> PostAnswersAsync(Models.Answer answer);
Task<Models.Answer> PostAnswersAsync(Models.Answer answer, string token);
}
}

View File

@ -4,7 +4,7 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface IAttachmentServiceProvider
{
Task<List<Attachment>> getAttachmentsAsync();
Task<IEnumerable<Attachment>> PostAttachmentsAsync(Models.AttachmentInfo attachmentInfo);
Task<List<Attachment>> getAttachmentsAsync(string token);
Task<IEnumerable<Attachment>> PostAttachmentsAsync(Models.AttachmentInfo attachmentInfo, string token);
}
}

View File

@ -4,7 +4,7 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface IEmployeeServiceProvider
{
Task<List<Employee>> getEmployeesAsync();
Task<Employee> getEmployeeAsync(int employeeId);
Task<List<Employee>> getEmployeesAsync(string token);
Task<Employee> getEmployeeAsync(int employeeId, string token);
}
}

View File

@ -4,6 +4,6 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface IHttpUtil
{
Task<string> SendAsync(HttpMethod method, string url, string JsonInput);
Task<string> SendAsync(HttpMethod method, string url, string JsonInput, string token);
}
}

View File

@ -4,6 +4,6 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface ILocationServiceProvider
{
Task<List<Location>> getLocationsAsync();
Task<List<Location>> getLocationsAsync(string token);
}
}

View File

@ -4,8 +4,8 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface IQuestionServiceProvider
{
Task<List<Question>> getQuestionsAsync();
Task<List<SurveyQuestions>> getSurveyQuestionsAsync(int surveyId);
Task<Question> getQuestionsAsync(int questionId);
Task<List<Question>> getQuestionsAsync(string token);
Task<List<SurveyQuestions>> getSurveyQuestionsAsync(int surveyId, string token);
Task<Question> getQuestionsAsync(int questionId, string token);
}
}

View File

@ -4,6 +4,6 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface IRegionServiceProvider
{
Task<List<Region>> getRegionsAsync();
Task<List<Region>> getRegionsAsync(string token);
}
}

View File

@ -4,7 +4,7 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface ISurveyServiceProvider
{
Task<List<Survey>> getSurveysAsync();
Task<Survey> getSurveyAsync(int surveyId);
Task<List<Survey>> getSurveysAsync(string token);
Task<Survey> getSurveyAsync(int surveyId,string token);
}
}

View File

@ -5,19 +5,19 @@ namespace DamageAssesment.Api.SurveyResponses.Interfaces
{
public interface ISurveysResponse
{
Task<(bool IsSuccess, dynamic Answers, string ErrorMessage)> GetAnswersByRegionAsync(int surveyId);
Task<(bool IsSuccess, dynamic Answers, string ErrorMessage)> GetAnswersByRegionAsync(int surveyId, string token);
Task<(bool IsSuccess, Models.SurveyResponse SurveyResponse, string ErrorMessage)> PostSurveyResponseAsync(Models.SurveyResponse surveyResponse);
// Task<(bool IsSuccess,dynamic surveyResponses, string ErrorMessage)> GetSurveyResponseAsync(int responseId);
Task<(bool IsSuccess, dynamic surveyResponses, string ErrorMessage)> GetSurveyResponsesAsync();
Task<(bool IsSuccess, dynamic surveyResponses, string ErrorMessage)> GetSurveyResponsesAsync(string token);
Task<(bool IsSuccess, Models.SurveyResponse SurveyResponse, string ErrorMessage)> PutSurveyResponseAsync(int Id, Models.SurveyResponse surveyResponse);
Task<(bool IsSuccess, Models.SurveyResponse SurveyResponse, string ErrorMessage)> DeleteSurveyResponseAsync(int Id);
Task<(bool IsSuccess, dynamic SurveyResponse, string ErrorMessage)> GetSurveyResponseByIdAsync(int responseId);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetSurveyResponsesBySurveyAsync(int surveyId);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetSurveyResponsesBySurveyAndLocationAsync(int surveyId, int locationId);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetSurveyResponsesByMaintenanceCenterAsync(int surveyId);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetResponsesByAnswerAsync(int surveyId, int questionId, string answer);
Task<(bool IsSuccess, dynamic SurveyResponse, string ErrorMessage)> GetSurveyResponseByIdAsync(int responseId, string token);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetSurveyResponsesBySurveyAsync(int surveyId, string token);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetSurveyResponsesBySurveyAndLocationAsync(int surveyId, int locationId, string token);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetSurveyResponsesByMaintenanceCenterAsync(int surveyId, string token);
Task<(bool IsSuccess, dynamic SurveyResponses, string ErrorMessage)> GetResponsesByAnswerAsync(int surveyId, int questionId, string answer, string token);
Task<(bool IsSuccess, Models.SurveyResponse SurveyResponse, string ErrorMessage)> PostSurveyAnswersAsync(Request request);
Task<(bool IsSuccess, Models.SurveyResponse SurveyResponse, string ErrorMessage)> PostSurveyAnswersAsync(Request request, string token);
}
}