private string GetAppKeyFromRequest(IHttpRequest httpRequest, ApplicationRequest requestDto) { string apiKey = httpRequest.Headers[ApiRegistration.AppKeyHeader]; if (string.IsNullOrEmpty(apiKey) && requestDto != null) { apiKey = requestDto.AppKey; } return apiKey; }
private string GetAppSecretFromRequest(IHttpRequest httpRequest, ApplicationRequest requestDto) { string secret = httpRequest.Headers[ApiRegistration.AppSecretHeader]; if (string.IsNullOrEmpty(secret) && requestDto != null) { secret = requestDto.AppSecret; } return secret; }
private IEnumerable<string> ValidateRequest(ApplicationRequest applicationRequest) { var errors = new List<string>(); if(string.IsNullOrEmpty(applicationRequest.AppKey)) { errors.Add("AppKey is empty"); } if (string.IsNullOrEmpty(applicationRequest.AppSecret)) { errors.Add("AppSecret is empty"); } if(applicationRequest.Account == null) { errors.Add("Account couldn't be found"); } if (applicationRequest.Application == null) { errors.Add("Application couldn't be found"); } return errors; }
public bool ValidApplicationRequest(ApplicationRequest request) { return !string.IsNullOrEmpty(request.AppKey) && !string.IsNullOrEmpty(request.AppSecret); }