/// <summary>
 /// Check that user has the specified access rights.
 /// </summary>
 /// <param name="context">Web service request context.</param>
 /// <param name="applicationIdentifier">Identifier of application to verify.</param>
 /// <param name="authorityIdentifier">Identifier of authority to verify.</param>
 /// <exception cref="ApplicationException">Thrown if user does not have the specified access rights.</exception>
 public virtual void CheckAuthorization(WebServiceContext context,
                                        ApplicationIdentifier applicationIdentifier,
                                        AuthorityIdentifier authorityIdentifier)
 {
     if (applicationIdentifier.ToString() == context.ClientToken.ApplicationIdentifier)
     {
         foreach (WebRole role in context.GetRoles())
         {
             if (role.Authorities.IsNotEmpty())
             {
                 foreach (WebAuthority authority in role.Authorities)
                 {
                     if (authority.Identifier == authorityIdentifier.ToString())
                     {
                         // User has the specified access rights.
                         return;
                     }
                 }
             }
         }
     }
     throw new ApplicationException("User:"******" does not have authority with identifier:" +
                                    authorityIdentifier.ToString() +
                                    " in application:" +
                                    context.ClientToken.ApplicationIdentifier);
 }
        public static void LaunchOnAndroid()
        {
#if UNITY_2020_1_OR_NEWER
            ApplicationIdentifier applicationIdentifier = CurrentConfiguration.GetComponentOrDefault <ApplicationIdentifier>();
            string packageName = applicationIdentifier.PackageName;
#else
            //BUG it may not be valid since the application identifier on SBP may be different from the on on PlayerSets
            string packageName = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
#endif

            string runTarget = $"\"{packageName}/com.unity3d.player.UnityPlayerActivity\"";
            ADB    adb       = ADB.GetInstance();

            try
            {
                EditorUtility.DisplayProgressBar("Launching", $"Launching {runTarget}", 0.6f);
                adb.Run(new[]
                {
                    "shell", "am", "start",
                    "-a", "android.intent.action.MAIN",
                    "-c", "android.intent.category.LAUNCHER",
                    "-f", "0x10200000",
                    "-S",
                    "-n", runTarget
                }, $"Failed to launch {runTarget}");
            }
            catch (Exception ex)
            {
                Debug.Log($"Error when launching: {ex}");
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }
Example #3
0
 public override void ProcessWebSocketMessage(string appName, string message, string socket)
 {
     if (appName.ToLower() == ApplicationIdentifier.ToLower())
     {
         Task.Factory.StartNew(() => SendWebSocketMessage(socket, new ClientRequest().ProcessClientMessage(socket, message)));
     }
 }
Example #4
0
        public AiUserControl(ApplicationIdentifier ai)
        {
            InitializeComponent();

            AiLabel.Content            = ai.AI;
            AiDescribtionLabel.Content = ai.Description;
            AiContentLabel.Content     = ai.Value;
        }
Example #5
0
        public override void ProcessWebSocketMessage(string appName, string message, string socket)
        {
            if (appName.ToLower() == ApplicationIdentifier.ToLower())
            {
                TpsLogManager <SemafoneConnection> .Info("Message received from " + socket + " :" + message);

                Task.Factory.StartNew(() => {
                    string response = new ClientRequest().ProcessClientMessage(socket, message);
                    SendWebSocketMessage(socket, response);
                    TpsLogManager <SemafoneConnection> .Info("Message sent to " + socket + " :" + response);
                });
            }
        }
        /// <summary>
        /// Get application by identifier.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="applicationIdentifier">Application identifier.</param>
        /// <returns>Requested application.</returns>
        public virtual IApplication GetApplication(IUserContext userContext,
                                                   ApplicationIdentifier applicationIdentifier)
        {
            foreach (IApplication application in GetApplications(userContext))
            {
                if (application.Identifier == applicationIdentifier.ToString())
                {
                    return(application);
                }
            }

            return(null);
        }
        protected WebClientInformation GetClientInformation(ApplicationIdentifier applicationIdentifier = ApplicationIdentifier.AnalysisPortal)
        {
            WebLoginResponse loginResponse;

            if (_clientInformation.IsNull())
            {
                loginResponse = WebServiceProxy.GeoReferenceService.Login(Settings.Default.TestUserName,
                                                                          Settings.Default.TestPassword,
                                                                          applicationIdentifier.ToString(),
                                                                          false);
                _clientInformation        = new WebClientInformation();
                _clientInformation.Locale = loginResponse.Locale;
                _clientInformation.Role   = null;
                _clientInformation.Token  = loginResponse.Token;
            }

            return(_clientInformation);
        }
Example #8
0
        private void UpdatePublicKeysTab(EmvApplication emv)
        {
            // Certification Authority Public Key
            var aidObject = new ApplicationIdentifier(emv.Aid);

            guiPublicKeysAID.Text = emv.Aid;
            guiPublicKeysRID.Text = aidObject.Rid;

            if (emv.TlvDataRecords.HasTag(0x8F))
            {
                guiPublicKeysCAIndex.Text = emv.TlvDataRecords.GetTag(0x8F).Value.ToHexa();
            }

            if (emv.CertificationAuthorityPublicKey != null)
            {
                guiPublicKeysCertificationAuthorityPKModulus.Text  = emv.CertificationAuthorityPublicKey.Modulus;
                guiPublicKeysCertificationAuthorityPKExponent.Text = emv.CertificationAuthorityPublicKey.Exponent;
            }

            // Issuer Public Key
            if (emv.IssuerPublicKeyCertificate != null)
            {
                guiPublicKeysIssuerPKRecoveredData.Text = emv.IssuerPublicKeyCertificate.Recovered.ToHexa('\0');
                guiPublicKeysIssuerPKHashResult.Text    = emv.IssuerPublicKeyCertificate.HashResult.ToHexa();
                guiPublicKeysIssuerPKModulus.Text       = emv.IssuerPublicKey.Modulus;
                guiPublicKeysIssuerPKExponent.Text      = emv.IssuerPublicKey.Exponent;
            }

            // ICC Public Key
            if (emv.IccPublicKeyCertificate != null)
            {
                guiPublicKeysICCPKRecoveredData.Text = emv.IccPublicKeyCertificate.Recovered.ToHexa('\0');
                guiPublicKeysICCPKHashResult.Text    = emv.IccPublicKeyCertificate.HashResult.ToHexa();
                guiPublicKeysICCPKModulus.Text       = emv.IccPublicKey.Modulus;
                guiPublicKeysICCPKExponent.Text      = emv.IccPublicKey.Exponent;
            }
        }
        protected WebServiceContext GetContext(ApplicationIdentifier applicationIdentifier)
        {
            if (_context.IsNotNull())
            {
                TestCleanup();
            }
            switch (applicationIdentifier)
            {
            case ApplicationIdentifier.ArtDatabankenSOA:
                _context = new WebServiceContextCached(WebServiceData.WebServiceManager.Name, applicationIdentifier.ToString());
                WebServiceData.UserManager.Login(_context, WebServiceData.WebServiceManager.Name, WebServiceData.WebServiceManager.Password, applicationIdentifier.ToString(), false);
                break;

            default:
                _context = new WebServiceContextCached(Settings.Default.TestUserName, applicationIdentifier.ToString());
                WebServiceData.UserManager.Login(_context, Settings.Default.TestUserName, Settings.Default.TestPassword, applicationIdentifier.ToString(), false);
                break;
            }
            if (_useTransaction)
            {
                _context.StartTransaction(_transactionTimeout);
            }
            return(_context);
        }
Example #10
0
        public override int GetHashCode()
        {
            int hashCode = 1465447186;

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (Card != null)
            {
                hashCode += Card.GetHashCode();
            }

            if (EntryMethod != null)
            {
                hashCode += EntryMethod.GetHashCode();
            }

            if (CvvStatus != null)
            {
                hashCode += CvvStatus.GetHashCode();
            }

            if (AvsStatus != null)
            {
                hashCode += AvsStatus.GetHashCode();
            }

            if (AuthResultCode != null)
            {
                hashCode += AuthResultCode.GetHashCode();
            }

            if (ApplicationIdentifier != null)
            {
                hashCode += ApplicationIdentifier.GetHashCode();
            }

            if (ApplicationName != null)
            {
                hashCode += ApplicationName.GetHashCode();
            }

            if (ApplicationCryptogram != null)
            {
                hashCode += ApplicationCryptogram.GetHashCode();
            }

            if (VerificationMethod != null)
            {
                hashCode += VerificationMethod.GetHashCode();
            }

            if (VerificationResults != null)
            {
                hashCode += VerificationResults.GetHashCode();
            }

            if (StatementDescription != null)
            {
                hashCode += StatementDescription.GetHashCode();
            }

            if (DeviceDetails != null)
            {
                hashCode += DeviceDetails.GetHashCode();
            }

            if (CardPaymentTimeline != null)
            {
                hashCode += CardPaymentTimeline.GetHashCode();
            }

            if (RefundRequiresCardPresence != null)
            {
                hashCode += RefundRequiresCardPresence.GetHashCode();
            }

            if (Errors != null)
            {
                hashCode += Errors.GetHashCode();
            }

            return(hashCode);
        }
Example #11
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CardPaymentDetails other &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((Card == null && other.Card == null) || (Card?.Equals(other.Card) == true)) &&
                   ((EntryMethod == null && other.EntryMethod == null) || (EntryMethod?.Equals(other.EntryMethod) == true)) &&
                   ((CvvStatus == null && other.CvvStatus == null) || (CvvStatus?.Equals(other.CvvStatus) == true)) &&
                   ((AvsStatus == null && other.AvsStatus == null) || (AvsStatus?.Equals(other.AvsStatus) == true)) &&
                   ((AuthResultCode == null && other.AuthResultCode == null) || (AuthResultCode?.Equals(other.AuthResultCode) == true)) &&
                   ((ApplicationIdentifier == null && other.ApplicationIdentifier == null) || (ApplicationIdentifier?.Equals(other.ApplicationIdentifier) == true)) &&
                   ((ApplicationName == null && other.ApplicationName == null) || (ApplicationName?.Equals(other.ApplicationName) == true)) &&
                   ((ApplicationCryptogram == null && other.ApplicationCryptogram == null) || (ApplicationCryptogram?.Equals(other.ApplicationCryptogram) == true)) &&
                   ((VerificationMethod == null && other.VerificationMethod == null) || (VerificationMethod?.Equals(other.VerificationMethod) == true)) &&
                   ((VerificationResults == null && other.VerificationResults == null) || (VerificationResults?.Equals(other.VerificationResults) == true)) &&
                   ((StatementDescription == null && other.StatementDescription == null) || (StatementDescription?.Equals(other.StatementDescription) == true)) &&
                   ((DeviceDetails == null && other.DeviceDetails == null) || (DeviceDetails?.Equals(other.DeviceDetails) == true)) &&
                   ((CardPaymentTimeline == null && other.CardPaymentTimeline == null) || (CardPaymentTimeline?.Equals(other.CardPaymentTimeline) == true)) &&
                   ((RefundRequiresCardPresence == null && other.RefundRequiresCardPresence == null) || (RefundRequiresCardPresence?.Equals(other.RefundRequiresCardPresence) == true)) &&
                   ((Errors == null && other.Errors == null) || (Errors?.Equals(other.Errors) == true)));
        }
Example #12
0
        private bool Validate(string value)
        {
            string pattern;

            switch (ApplicationIdentifier)
            {
            case SSCC18:
            case ComponentId:
            case GSRN:
                pattern = "^\\d{18}$";
                break;

            case GTIN:
            case NumberofContainersContained:
                pattern = "^\\d{14}$";
                break;

            case BatchNumbers:
            case SerialNumber:
                pattern = "^[a-z0-9]{1,20}$";
                break;

            case ProductionDate:
            case DueDate:
            case PackagingDate:
            case BestBeforeDate:
            case ExpirationDate:
                pattern = "^\\d{2}(0[1-9]|1[0-2])([0-2]\\d|3[01])$";
                break;

            case VariantNumber:
            case CouponExtendedCode0:
                pattern = "^\\d{2}$";
                break;

            case SecondaryDataField:
                pattern = "^[a-z0-9]{1,29}$";
                break;

            case AdditionalItemIdentification:
            case CustomerPartNumber:
            case SecondSerialNumber:
            case ReferenceToSourceEntity:
            case CustomerPurchaseOrderNumber:
            case GINC:
            case RoutingCode:
            case UNCutClassification:
            case GIAI:
            case IBAN:
            case CouponCodeIDNorthAmerica:
            case TradingPartners:
            case InternalCompanyCodes1:
            case InternalCompanyCodes2:
            case InternalCompanyCodes3:
            case InternalCompanyCodes4:
            case InternalCompanyCodes5:
            case InternalCompanyCoeds6:
            case InternalCompanyCodes7:
            case InternalCompanyCodes8:
            case InternalCompanyCodes9:
                pattern = "^[a-z0-9]{1,30}$";
                break;

            case MadeToOrderVariationNumber:
                pattern = "^\\d{1,6}";
                break;

            case GDTI:
                pattern = "^\\d{14,30}$";
                break;

            case GLNExtension:
                pattern = "^[a-z0-9]{1,20}$";
                break;

            case CountofItems:
            case CountofTradeItems:
                pattern = "^\\d{1,8}$";
                break;

            case ProductNetWeightKg:
            case ProductLengthMeters:
            case ProductWidthMeters:
            case ProductDepthMeters:
            case ProductAreaSquareMeters:
            case NetVolumeLiters:
            case NetVolumeCubicMeters:
            case NetWeightPounds:
            case ProductLengthInches:
            case ProductLengthFeet:
            case ProductLengthYards:
            case ProductWidthInches:
            case ProductWidthFeet:
            case ProductWidthYards:
            case ProductDepthInches:
            case ProductDepthFeet:
            case ProductDepthYards:
            case LogiticWeightKg:
            case ContainerLengthMeters:
            case ContainerWidthMeters:
            case ContainerDepthMeters:
            case ContainerAreaSquareMeters:
            case LogisticVolumeLiters:
            case LogisticVolumeCubicMeters:
            case KilogramsPerSquareMetre:
            case LogisticWeightPounds:
            case ContainerLengthInches:
            case ContainerLengthFeet:
            case ContainerLengthYards:
            case ContainerWidthInches:
            case ContainerWidthFeet:
            case ContainerWidthYards:
            case ContainerDepthInches:
            case ContainerDepthFeet:
            case ContainerDepthYards:
            case ProductAreaSquareInches:
            case ProductAreaSquareFeet:
            case ProductAreaSquareYards:
            case ContainerAreaSquareInches:
            case ContainerAreaSquareFeet:
            case ContainerAreaSuqareYards:
            case NetWeightTroyOunces:
            case NetWeightOunces:
            case NetVolumeQuarts:
            case NetVolumeGallons:
            case LogisticVolumeQuarts:
            case LogisticVolumeGallons:
            case NetVolumeCubicInches:
            case NetVolumeCubicFeet:
            case NetVolumeCubicYards:
            case LogisticGrossVolumeCubicInches:
            case LogisticGrossVolumeCubicFeet:
            case LogisticGrossVolumeCubicYards:
                pattern = "^\\d{7}$";
                break;

            case PricePerUnit:
            case CouponExtendedCode:
                pattern = "^\\d{6}$";
                break;

            case AmountPayable:
            case AmountPayableArea:
                pattern = "^\\d{1,15}$";
                break;

            case AmountPayableISO:
            case AmountPayableAreaISO:
                pattern = "^\\d{4,18}$";
                break;

            case GSIN:
                pattern = "^\\d{17}$";
                break;

            case ShipToLocationCode:
            case BillToLocationCode:
            case PurchaseFromLocationCode:
            case ShipForLocationCode:
            case PhysicalLocationId:
            case InvoicingPartyLocationCode:
            case NATOStockNumber:
                pattern = "^\\d{13}$";
                break;

            case ShipToPostalCode:
                pattern = "^[a-z0-9]{1,20}$";
                break;

            case ShipToPostalCodeISO:
                pattern = "^\\d{3}[a-z0-9]{1,9}$";
                break;

            case CountryofOrigin:
            case CountryOfProcessing:
            case CountryOfDisassembly:
            case CountryCoveringProcessChain:
                pattern = "^\\d{3}$";
                break;

            case CountryOfInitialProcessing:
                pattern = "^\\d{3,15}$";
                break;

            case ExpirationDateTime:
                pattern = "^\\d{10}$";
                break;

            case ActivePotency:
                pattern = "^\\d{1,4}$";
                break;

            case RollProducts:
                pattern = "^\\d{14}$";
                break;

            case CellularMobileID:
                pattern = "^[a-z0-9]{1,20}$";
                break;

            case GRAI:
                pattern = "^\\d{14}[a-z0-9]{1,16}$";
                break;

            case ProductionDateTime:
                pattern = "^\\d{8,12}$";
                break;

            case PaymentSlipReference:
                pattern = "^[a-z0-9]{1,25}$";
                break;

            case CouponExtendedCodeEndofOffer:
                pattern = "^\\d{10}$";
                break;

            default:
                throw new NotSupportedException("Unsupported AI code [" + ApplicationIdentifier.ToString() + "].");
            }

            if (System.Text.RegularExpressions.Regex.IsMatch(value, pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
            {
                return(true);
            }

            throw new ApplicationException("The value does not meet the specification for the Application Identifier.");
        }