/** * Get the countries. */ public async Task <APIGatewayProxyResponse> GetCountries(IDataStores dataStores, APIGatewayProxyRequest request) { Debug.Tested(); Debug.AssertValid(dataStores); Debug.AssertValid(request); try { // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Security check User user = await APIHelper.CheckLoggedInAsAdmin(dbClient, request.Headers); Debug.AssertValid(user); // Get response information IEnumerable <Country> countries = await CountryServiceLogicLayer.GetCountries(dbClient); Debug.AssertValid(countries); // Return response return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_OK, Body = JsonConvert.SerializeObject(countries) }); } catch (Exception exception) { Debug.Unreachable(); return(APIHelper.ResponseFromException(exception)); } }
/** * Set user address. */ private async Task <APIGatewayProxyResponse> VerifyEmailWithDetails(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::VerifyEmailWithDetails()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs VerifyEmailWithDetailsRequest verifyEmailWithDetailsRequest = UserIdentityService_VerifyEmailWithDetails_LogicLayer.CheckValidVerifyEmailWithDetailsRequest(requestBody); Debug.AssertValid(verifyEmailWithDetailsRequest); // Perform logic await UserIdentityService_VerifyEmailWithDetails_LogicLayer.VerifyEmailWithDetails(dbClient, verifyEmailWithDetailsRequest); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } }
/** * Refresh access token. */ public async Task <APIGatewayProxyResponse> RefreshAccessToken(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValid(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::RefreshAccessToken()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs APIHelper.CheckEmptyRequestBody(requestBody); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic DateTime?expiryTime = await UserIdentityService_RefreshAccessToken_LogicLayer.RefreshAccessToken(dbClient, loggedInUserId); Debug.AssertValid(expiryTime); // Respond RefreshAccessTokenResponse response = new RefreshAccessTokenResponse { expiryTime = APIHelper.APIDateTimeStringFromDateTime(expiryTime) }; return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_OK, Body = JsonConvert.SerializeObject(response) }); //??--return Ok(response); } catch (Exception exception) { Debug.Tested(); if (exception.Message == IdentityServiceLogicLayer.ERROR_CANNOT_EXTEND_ACCESS_TOKEN) { Debug.Untested(); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_FORBIDDEN, Body = $"{{ error = {IdentityServiceLogicLayer.CANNOT_EXTEND_ACCESS_TOKEN} }}" }); //??--return StatusCode(APIHelper.STATUS_CODE_FORBIDDEN, new GeneralErrorResponse { error = IdentityServiceLogicLayer.CANNOT_EXTEND_ACCESS_TOKEN }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Set user address. */ private async Task <APIGatewayProxyResponse> VerifyPhoneNumber(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::VerifyPhoneNumber()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs VerifyPhoneNumberRequest verifyPhoneNumberRequest = UserIdentityService_VerifyPhoneNumber_LogicLayer.CheckValidVerifyPhoneNumberRequest(requestBody); Debug.AssertValid(verifyPhoneNumberRequest); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic await UserIdentityService_VerifyPhoneNumber_LogicLayer.VerifyPhoneNumber(dbClient, loggedInUserId, verifyPhoneNumberRequest); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Tested(); if (exception.Message == IdentityServiceLogicLayer.ERROR_INCORRECT_PASSWORD) { Debug.Untested(); //??-- ObjectResult result = new ObjectResult(new GeneralErrorResponse { error = IdentityServiceLogicLayer.INCORRECT_PASSWORD }); // result.StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED; // return result; return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED, Body = $"{{ error = \"{IdentityServiceLogicLayer.INCORRECT_PASSWORD}\" }}" }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Set user phone number. */ private async Task <APIGatewayProxyResponse> ResetUserPassword(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::ResetUserPassword()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs ResetUserPasswordRequest resetUserPasswordRequest = UserIdentityService_ResetUserPassword_LogicLayer.CheckValidResetUserPasswordRequest(requestBody); Debug.AssertValid(resetUserPasswordRequest); // Check reCaptcha ReCaptchaHelper.CheckReCaptchaToken(resetUserPasswordRequest.reCaptcha); // Perform logic await UserIdentityService_ResetUserPassword_LogicLayer.ResetUserPassword(dbClient, resetUserPasswordRequest); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Tested(); if ((exception.Message == SharedLogicLayer.ERROR_UNRECOGNIZED_EMAIL_ADDRESS) || (exception.Message == IdentityServiceLogicLayer.ERROR_EMAIL_NOT_VERIFIED) || (exception.Message == ReCaptchaHelper.ERROR_INVALID_RECAPTCHA_TOKEN)) { Debug.Tested(); // Note tht no error code is returned for security reasons. //??--return StatusCode(APIHelper.STATUS_CODE_FORBIDDEN); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_FORBIDDEN }); } else { Debug.Untested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Set user password. */ internal async Task <APIGatewayProxyResponse> SetUserPassword(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::SetUserPassword()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs SetUserPasswordRequest setUserPasswordRequest = UserIdentityService_SetUserPassword_LogicLayer.CheckValidSetUserPasswordRequest(requestBody); Debug.AssertValid(setUserPasswordRequest); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic await UserIdentityService_SetUserPassword_LogicLayer.SetUserPassword(dbClient, loggedInUserId, setUserPasswordRequest); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Tested(); if (exception.Message == IdentityServiceLogicLayer.ERROR_INCORRECT_PASSWORD) { Debug.Untested(); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED, Body = $"{{ body = \"{IdentityServiceLogicLayer.INCORRECT_PASSWORD}\"}}" }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Get the countries. */ public async Task <APIGatewayProxyResponse> GetCountries(IDataStores dataStores) { Debug.Tested(); Debug.AssertValid(dataStores); try { // Get the NoSQL DB client AmazonDynamoDBClient dbClient = dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Get response information IEnumerable <Country> countries = await CountryServiceLogicLayer.GetCountries(dbClient); Debug.AssertValid(countries); GetCountriesResponse responseBody = new GetCountriesResponse(); List <GetCountryResponse> availableCountries = new List <GetCountryResponse>(); foreach (Country country in countries) { Debug.Tested(); Debug.AssertValid(country); if (country.Available) { Debug.Tested(); availableCountries.Add(new GetCountryResponse { code = country.Code, name = country.Name, currencies = country.Currencies.ToArray() }); } else { Debug.Tested(); } } responseBody.countries = availableCountries.ToArray(); // Return response return(new APIGatewayProxyResponse { StatusCode = STATUS_CODE_OK, Body = JsonConvert.SerializeObject(responseBody) }); } catch (Exception exception) { Debug.Unreachable(); return(APIHelper.ResponseFromException(exception)); } }
/** * Get user permissions. */ public async Task <APIGatewayProxyResponse> GetUserPermissions(IDataStores dataStores, IDictionary <string, string> requestHeaders) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::GetUserPermissions()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic var permissions = await UserIdentityService_GetUserPermissions_LogicLayer.GetUserPermissions(dbClient, loggedInUserId); Debug.AssertValid(permissions); GetPermissionsResponse response = new GetPermissionsResponse(); response.permissions = permissions; //??--GetPermissionsResponse response = await UserIdentityService_GetUserPermissions_LogicLayer.GetUserPermissions(dbClient, loggedInUserId); //Debug.AssertValid(response); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_OK, Body = JsonConvert.SerializeObject(response) }); } catch (Exception exception) { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } }
/** * Set user allow non-essential emails. */ private async Task <APIGatewayProxyResponse> SetUserAllowNonEssentialEmails(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::SetUserAllowNonEssentialEmails()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs SetUserAllowNonEssentialEmailsRequest setUserAllowNonEssentialEmailsRequest = UserIdentityService_SetUserAllowNonEssentialEmails_LogicLayer.CheckValidSetUserAllowNonEssentialEmailsRequest(requestBody); Debug.AssertValid(setUserAllowNonEssentialEmailsRequest); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic await UserIdentityService_SetUserAllowNonEssentialEmails_LogicLayer.SetUserAllowNonEssentialEmails(dbClient, loggedInUserId, setUserAllowNonEssentialEmailsRequest); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } }
/** * Get the countries. */ public async Task <APIGatewayProxyResponse> UpdateCountry(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Tested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"AdminCountryService::UpdateCountry()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs Country country = CountryServiceLogicLayer.CheckValidUpdateCountryRequest(requestBody); // Check security User user = await APIHelper.CheckLoggedInAsAdmin(dbClient, requestHeaders); Debug.AssertValid(user); // Perform logic bool created = await CountryServiceLogicLayer.UpdateCountry(dbClient, loggedInUserId, country); // Return response return(new APIGatewayProxyResponse { StatusCode = created ? APIHelper.STATUS_CODE_CREATED : APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Unreachable(); return(APIHelper.ResponseFromException(exception)); } }
/** * Set user email. */ internal async Task <APIGatewayProxyResponse> SetUserEmail(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::SetUserEmail()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs SetUserEmailRequest setUserEmailRequest = UserIdentityService_SetUserEmail_LogicLayer.CheckValidSetUserEmailRequest(requestBody); Debug.AssertValid(setUserEmailRequest); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic await UserIdentityService_SetUserEmail_LogicLayer.SetUserEmail(dbClient, loggedInUserId, setUserEmailRequest); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_NO_CONTENT }); } catch (Exception exception) { Debug.Tested(); if ((exception.Message == IdentityServiceLogicLayer.ERROR_EMAIL_IN_USE) || (exception.Message == IdentityServiceLogicLayer.ERROR_EMAIL_ALREADY_BEING_CHANGED)) { Debug.Untested(); GeneralErrorResponse response = new GeneralErrorResponse(); if (exception.Message == IdentityServiceLogicLayer.ERROR_EMAIL_IN_USE) { Debug.Untested(); response.error = IdentityServiceLogicLayer.EMAIL_IN_USE; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_EMAIL_ALREADY_BEING_CHANGED) { Debug.Untested(); response.error = IdentityServiceLogicLayer.EMAIL_ALREADY_BEING_CHANGED; } //??--ObjectResult result = new ObjectResult(response); //??--result.StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED; //??--return StatusCode(APIHelper.STATUS_CODE_UNAUTHORIZED, response); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED, Body = JsonConvert.SerializeObject(response) }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Create a new account. */ internal async Task <APIGatewayProxyResponse> CreateAccount(IDataStores dataStores, JObject requestBody) { Debug.Tested(); Debug.AssertValid(dataStores); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::CreateAccount()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs CreateAccountRequest createAccountRequest = UserIdentityService_CreateAccount_LogicLayer.CheckValidCreateAccountRequest(requestBody); Debug.AssertValid(createAccountRequest); // Perform logic Tuple <User, bool> result = await UserIdentityService_CreateAccount_LogicLayer.CreateAccount(dbClient, createAccountRequest); Debug.AssertValid(result); Debug.AssertValid(result.Item1); if (!result.Item2) { Debug.Tested(); // New account //???string location = "/identity/self/user-details"; CreateAccountResponse response = new CreateAccountResponse(); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_CREATED, Headers = null, Body = JsonConvert.SerializeObject(response) });//??--Created(location, response); } else { // Account re-opened Debug.Tested(); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_OK }); //??--Ok(); } } catch (Exception exception) { Debug.Tested(); if ((exception.Message == IdentityServiceLogicLayer.ERROR_EMAIL_IN_USE) || (exception.Message == IdentityServiceLogicLayer.ERROR_USER_ACCOUNT_CLOSED)) { Debug.Untested(); return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_FORBIDDEN, Body = $"{{ body = \"{exception.Message}\"}}" });//??--StatusCode(APIHelper.STATUS_CODE_FORBIDDEN, new GeneralErrorResponse { error = exception.Message }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Login */ internal async Task <APIGatewayProxyResponse> Login(IDataStores dataStores, JObject requestBody) { Debug.Untested(); Debug.AssertValidOrNull(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::Login()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs LoginRequest loginRequest = UserIdentityService_Login_LogicLayer.CheckValidLoginRequest(requestBody); Debug.AssertValid(loginRequest); // Perform logic LoginResponse response = new LoginResponse(); Tuple <string, DateTime> result = await UserIdentityService_Login_LogicLayer.Login(dbClient, loginRequest); Debug.AssertValid(result); response.accessToken = result.Item1; response.expiryTime = APIHelper.APIDateTimeStringFromDateTime(result.Item2); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_OK, Body = JsonConvert.SerializeObject(response) }); } catch (Exception exception) { Debug.Tested(); if ((exception.Message == SharedLogicLayer.ERROR_UNRECOGNIZED_EMAIL_ADDRESS) || (exception.Message == IdentityServiceLogicLayer.ERROR_INCORRECT_PASSWORD) || (exception.Message == IdentityServiceLogicLayer.ERROR_USER_ACCOUNT_CLOSED) || (exception.Message == IdentityServiceLogicLayer.ERROR_USER_BLOCKED) || (exception.Message == IdentityServiceLogicLayer.ERROR_USER_LOCKED)) { Debug.Tested(); string error = null; if (exception.Message == SharedLogicLayer.ERROR_UNRECOGNIZED_EMAIL_ADDRESS) { Debug.Tested(); error = IdentityServiceLogicLayer.USER_NOT_FOUND; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_INCORRECT_PASSWORD) { Debug.Tested(); error = IdentityServiceLogicLayer.USER_NOT_FOUND; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_USER_ACCOUNT_CLOSED) { Debug.Tested(); error = IdentityServiceLogicLayer.ACCOUNT_CLOSED; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_USER_BLOCKED) { Debug.Tested(); error = IdentityServiceLogicLayer.USER_BLOCKED; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_USER_LOCKED) { Debug.Tested(); error = IdentityServiceLogicLayer.USER_LOCKED; } //??-- ObjectResult result = new ObjectResult(response); // result.StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED; // return result; return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED, Body = $"{{ error = \"{error}\"}}" }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }
/** * Check password. */ public async Task <APIGatewayProxyResponse> CheckPassword(IDataStores dataStores, IDictionary <string, string> requestHeaders, JObject requestBody) { Debug.Untested(); Debug.AssertValid(dataStores); Debug.AssertValid(requestHeaders); Debug.AssertValid(requestBody); try { // Log call LoggingHelper.LogMessage($"UserIdentityService::CheckPassword()"); // Get the NoSQL DB client AmazonDynamoDBClient dbClient = (AmazonDynamoDBClient)dataStores.GetNoSQLDataStore().GetDBClient(); Debug.AssertValid(dbClient); // Check inputs CheckPasswordRequest checkPasswordRequest = UserIdentityService_CheckPassword_LogicLayer.CheckValidCheckPasswordRequest(requestBody); Debug.AssertValid(checkPasswordRequest); // Check authenticated endpoint security string loggedInUserId = await APIHelper.CheckLoggedIn(dbClient, requestHeaders); Debug.AssertID(loggedInUserId); // Perform logic await UserIdentityService_CheckPassword_LogicLayer.CheckPassword(dbClient, checkPasswordRequest, loggedInUserId); // Respond return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_OK }); } catch (Exception exception) { Debug.Tested(); if ((exception.Message == IdentityServiceLogicLayer.ERROR_INCORRECT_PASSWORD) || (exception.Message == IdentityServiceLogicLayer.ERROR_USER_BLOCKED) || (exception.Message == IdentityServiceLogicLayer.ERROR_USER_LOCKED)) { Debug.Untested(); //??--GeneralErrorResponse response = new GeneralErrorResponse(); string error = null; if (exception.Message == IdentityServiceLogicLayer.ERROR_INCORRECT_PASSWORD) { Debug.Tested(); error = IdentityServiceLogicLayer.INCORRECT_PASSWORD; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_USER_BLOCKED) { Debug.Tested(); error = IdentityServiceLogicLayer.USER_BLOCKED; } else if (exception.Message == IdentityServiceLogicLayer.ERROR_USER_LOCKED) { Debug.Tested(); error = IdentityServiceLogicLayer.USER_LOCKED; } //??-- ObjectResult result = new ObjectResult(response); // result.StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED; // return result; return(new APIGatewayProxyResponse { StatusCode = APIHelper.STATUS_CODE_UNAUTHORIZED, Body = $"{{ error = \"{error}\"}}" }); } else { Debug.Tested(); return(APIHelper.ResponseFromException(exception)); } } }