public virtual void VerifyApiAccessPermission()
        {
            KCSiteMaster row = SiteMaster.Current;

            if (row == null)
            {
                return;
            }

            if (row.ApplicationId != "" && row.SharedSecret != "")
            {
                PXLongOperation.StartOperation(this, delegate()
                {
                    KCInternalReponse response = new KCSiteMasterHelper().VerifyApiAccess(row);
                    if (response != null)
                    {
                        if (!response.IsSuccess && !string.IsNullOrEmpty(response.Message))
                        {
                            throw new PXException(response.Message);
                        }
                        else if (!string.IsNullOrEmpty(response.Message))
                        {
                            PXTrace.WriteInformation(response.Message);
                        }
                    }
                    else
                    {
                        string exceptionmsg = string.Format(KCConstants.DualParameters, KCConstants.VerifyApiAccess, KCMessages.NullException);
                        throw new PXException(exceptionmsg);
                    }
                });
            }
        }
Exemplo n.º 2
0
        private void GetAccessToken()
        {
            KCInternalReponse response = new KCSiteMasterHelper().VerifyApiAccess(_xSiteMaster);

            if (response.Data == null)
            {
                throw new PXException(KCMessages.InternalServerError);
            }
            _token = JsonConvert.DeserializeObject <Entity.KCAPIAccessToken>(response.Data);
        }