{"id":17668534,"url":"https://github.com/evanshortiss/redhat-mobile-demo-application","last_synced_at":"2026-04-05T21:32:31.998Z","repository":{"id":66153937,"uuid":"134320954","full_name":"evanshortiss/redhat-mobile-demo-application","owner":"evanshortiss","description":"Application that is designed to be easily modified to demo AeroGear's device security checks","archived":false,"fork":false,"pushed_at":"2018-05-23T16:28:20.000Z","size":13150,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T13:25:07.351Z","etag":null,"topics":["aerogear","android","cordova","demo","ionic","ios","javascript","phonegap","security","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/aerogear","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evanshortiss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-21T20:19:57.000Z","updated_at":"2018-05-23T16:28:22.000Z","dependencies_parsed_at":"2023-07-08T13:46:37.059Z","dependency_job_id":null,"html_url":"https://github.com/evanshortiss/redhat-mobile-demo-application","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evanshortiss/redhat-mobile-demo-application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fredhat-mobile-demo-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fredhat-mobile-demo-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fredhat-mobile-demo-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fredhat-mobile-demo-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evanshortiss","download_url":"https://codeload.github.com/evanshortiss/redhat-mobile-demo-application/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fredhat-mobile-demo-application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31451439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aerogear","android","cordova","demo","ionic","ios","javascript","phonegap","security","typescript"],"created_at":"2024-10-23T23:22:54.777Z","updated_at":"2026-04-05T21:32:31.950Z","avatar_url":"https://github.com/evanshortiss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Work in Progress\nThis repository is a work in progress.\n\n## Demo - Device Security in Minutes\nThis application can be used to demonstrate how easy it is to add self-defense\nchecks using AeroGear to an application.\n\n## Requirements\n\n1. Node.js v6.11+\n2. npm 5.6+\n3. Ionic CLI v3.20.0 (npm install -g ionic@3.20)\n4. Android/iOS SDK \u0026 Tools\n5. Minishift with [Mobile Core Addon](https://github.com/aerogear/minishift-mobilecore-addon)\n\n## Running the Application\nInstall dependencies first via `npm i`.\n\n### Browser\n`npm run ionic:serve`\n\n### Android Emulator\n`ionic cordova emulate android`\n\n### iOS Simulator\n`ionic cordova emulate ios`\n\n\n## Steps to Enforce Security\n1. Provision the Metrics service on OpenShift into a new or existing project\n2. Create an Android/iOS Application in OpenShift and use `com.redhat.acmebank`\nas the package name.\n3. Bind the Application and Metrics service then copy the resulting\nconfiguration to the `src` folder here and name it `mobile-services.json`. It\nshould look something like this:\n\n```json\n{\n  \"version\": 1,\n  \"clusterName\": \"https://192.168.64.23:8443\",\n  \"namespace\": \"acmebank\",\n  \"clientId\": \"myapp-android\",\n  \"services\": [\n    {\n      \"id\": \"metrics\",\n      \"name\": \"metrics\",\n      \"type\": \"metrics\",\n      \"url\": \"https://aerogear-app-metrics-acmebank.192.168.64.23.nip.io/metrics\",\n      \"config\": {}\n    }\n  ]\n}\n\n```\n\n4. Add the following AeroGear modules/plugins to this project:\n    1. `ionic cordova plugin add @aerogear/cordova-plugin-aerogear-security --save`\n    2. `ionic cordova plugin add @aerogear/cordova-plugin-aerogear-metrics --save`\n    3. `npm install @aerogear/app --save`\n    4. `npm install @aerogear/security --save`\n5. Create a `src/services/security.ts` file and paste the following content:\n\n```ts\nimport { Injectable } from '@angular/core';\nimport { SecurityService, SecurityCheckType, SecurityCheck } from '@aerogear/security';\n\n@Injectable()\nexport class DeviceSecurity {\n  private securityService: SecurityService;\n  private isBrowser: boolean\n\n  constructor() {\n    this.isBrowser = document.URL.indexOf('http') === 0\n\n    if (!this.isBrowser) {\n      this.securityService = new SecurityService();\n\n      this.securityService.checkManyAndPublishMetric(\n        SecurityCheckType.notDebugMode,\n        SecurityCheckType.notRooted,\n        SecurityCheckType.notEmulated,\n        SecurityCheckType.hasDeviceLock\n      );\n    }\n  }\n\n  private check (check: SecurityCheck) {\n    if (this.isBrowser) {\n      // Just flag everything as a \"pass\" in the browser\n      return Promise.resolve(true)\n    }\n\n    return this.securityService.check(check)\n      .then(check =\u003e check.passed)\n  }\n\n  isRooted() {\n    return this.check(SecurityCheckType.notRooted)\n      // invert result since isRooted should be true if the check returns false\n      .then((pass) =\u003e !pass)\n  }\n\n  isDeviceLockEnabled() {\n    return this.check(SecurityCheckType.hasDeviceLock)\n  }\n}\n```\n\n6. In `app.component.ts` add the following `import` and initialise the SDK\nbefore `platform.ready()`:\n\n```ts\n// Add this to the top of the file\nimport { init } from '@aerogear/app';\n\n// Necessary to prevent compiler warnings\ndeclare var require: any\n\n// Initialise the mobile services SDK\nlet appConfig = require('../mobile-services.json');\ninit(appConfig);\n```\n\n7. In `login.ts` add the following snippets:\n    1. `import { DeviceSecurity } from '../../services/security'`\n    2. `private sec: DeviceSecurity` to the constructor\n    3. `ionViewDidEnter() {}` to the class\n\n8. Add the following code in the `ionViewDidEnter()` function you created:\n\n```ts\nthis.sec.isRooted()\n  .then((rooted) =\u003e {\n    if (rooted) {\n      let alert = this.alertCtrl.create({\n        title: 'Insecure Device',\n        subTitle: 'We detected that this device is rooted. Running as root increases the likelihood of your device being compromised by malicious software that is designed to steal passwords and financial information. Continued use of this application is done so at your own risk.',\n        buttons: ['OK']\n      });\n\n      alert.present();\n    }\n  })\n```\n\n9. In `login.ts` update the `onPersistChange()` function like so:\n\n```ts\nthis.sec.isDeviceLockEnabled()\n  .then((lockEnabled) =\u003e {\n    if (!lockEnabled) {\n      let alert = this.alertCtrl.create({\n        title: 'Device Lock Required',\n        subTitle: 'The \"Stay Logged In\" feature requires a device lock to be enabled. Update your device security settings and try again.',\n        buttons: ['OK']\n      });\n\n      alert.present();\n\n      // Don't allow the checkbox to be checked\n      this.persistentLogin = false\n    }\n  })\n```\n\n10. Finally update `app.module.ts` by adding:\n    1. `import { DeviceSecurity } from '../services/security';` at the top\n    2. `DeviceSecurity` to the `providers` Array in the `@NgModule` block\n\n## Icon Credits\nIcons made by [Roundicons](https://www.flaticon.com/authors/roundicons) from \n[www.flaticon.com](https://www.flaticon.com/) are licensed by\n[CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)\n\nIcons made by [Freepik](http://www.freepik.com) from \n[www.flaticon.com](https://www.flaticon.com/) are licensed by\n[CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)\n\nIcons made by [Pixel Buddha](https://www.flaticon.com/authors/pixel-buddha) from \n[www.flaticon.com](https://www.flaticon.com/) are licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanshortiss%2Fredhat-mobile-demo-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevanshortiss%2Fredhat-mobile-demo-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanshortiss%2Fredhat-mobile-demo-application/lists"}