public async Task <IActionResult> AuthenticateToken() { var response = new JsonResult <AuthResult>() { Success = false, Result = new AuthResult() }; if (!GenericCheck(() => _TokenService.HasToken, response, StatusCodes.Status401Unauthorized, SiteErrorCodes.NotAuthorized)) { return(JsonResult(response)); } var authRes = await _SwiftService.AuthenticateTokenAsync(_TokenService.Token.AuthAPIV3EndPoint, _TokenService.Token.Token); if (!GenericCheck(() => authRes.IsSuccess, response, (int)authRes.StatusCode, SiteErrorCodes.InvalidCredentials)) { response.Error += "\n" + authRes.Reason; return(JsonResult(response)); } response.Result.AuthResponse = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(authRes.ContentStr), Formatting.Indented); response.Success = true; //response.Result.RedirectLink = Url.RouteUrl(Routes.GET_Explore_Route); return(JsonResult(StatusCodes.Status200OK, response)); }
public async Task <IActionResult> Index(string accountUrl = null, string container = null, string objectName = null) { if (!_TokenService.HasToken) { return(View("/Views/Home/Index.cshtml")); } if (accountUrl.IsNullOrEmpty()) { var authRes = await _SwiftService.AuthenticateTokenAsync(_TokenService.Token.AuthAPIV3EndPoint, _TokenService.Token.Token); return(View("/Views/Explorer/EnterAccountUrl.cshtml", authRes)); } _SwiftService.InitToken(_TokenService.Token.Token); if (container.IsNullOrEmpty()) { var ss = await _SwiftService.AccountListContainersAsync(accountUrl); return(View("/Views/Explorer/GetAccount.cshtml", ss)); } if (objectName.IsNullOrEmpty()) { var ss = await _SwiftService.ContainerGetAsync(accountUrl, container); return(View("/Views/Explorer/GetContainer.cshtml", ss)); } { var ss = await _SwiftService.ObjectHeadAsync(accountUrl, container, objectName); return(View("/Views/Explorer/GetObject.cshtml", ss)); } }