Skip to content

Commit

Permalink
Entity generation and OAuth support for Ionic 4 (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Raible committed Jun 12, 2019
1 parent 1337c12 commit 2c2bed0
Show file tree
Hide file tree
Showing 82 changed files with 9,337 additions and 5,903 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand All @@ -12,6 +12,3 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
indent_size = 2
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -31,6 +31,7 @@ env:
# environment properties
- SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
- SPRING_JPA_SHOW_SQL=false
- NG_CLI_ANALYTICS=false
matrix:
- JHIPSTER=ngx-mysql PROFILE=dev PROTRACTOR=1
- JHIPSTER=ngx-oauth2 PROFILE=dev PROTRACTOR=1
Expand All @@ -41,7 +42,9 @@ before_install:
- sudo /etc/init.d/postgresql stop
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm -g install yo ionic cordova
- npm -g install yo ionic @angular-devkit/schematics-cli
- git clone https://github.com/jhipster/jhipster.git
- cd jhipster && ./mvnw clean install -Dgpg.skip=true
- chmod +x $JHIPSTER_INSTALL/*.sh
- chmod +x $JHIPSTER_SCRIPTS/*.sh
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
Expand Down
71 changes: 71 additions & 0 deletions README.md
Expand Up @@ -45,6 +45,77 @@ In a directory alongside your JHipster app, run this module. This will create an
yo jhipster-ionic
```

# Okta for Authentication

If you choose OAuth 2.0 / OIDC for authentication, you can use Okta for authentication. See [JHipster's security docs](https://www.jhipster.tech/security/#-oauth2-and-openid-connect) to see how to configure JHipster for Okta. You should be able to use the same OIDC app for Ionic for JHipster. However, you'll need to add a few redirect URIs:

## Create an Application in Okta

Log in to your Okta Developer account (or [sign up](https://developer.okta.com/signup/) if you don't have an account).

From the **Applications** page, choose **Add Application**. On the Create New Application page, select **Native**. Give your app a memorable name, and configure it as follows:

* Login redirect URIs:
* `http://localhost:8100/implicit/callback`
* `dev.localhost.ionic:/callback`
* Logout redirect URIs:
* `http://localhost:8100/implicit/logout`
* `dev.localhost.ionic:/logout`

**NOTE:** `dev.localhost.ionic` is the default scheme, but you can also use something more traditional like `com.okta.dev-737523` (where `dev-737523.okta.com` is your Okta Org URL). If you'd like to change it, be sure to update the `URL_SCHEME` in `package.json`.

```json
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "com.okta.dev-737523"
},
```

# iOS

Generate a native project with the following command:

```
ionic cordova prepare ios
```

Open your project in Xcode, configure code signing, and run your app.

```
open platforms/ios/MyApp.xcworkspace
```

# Android

Generate a native project with the following command:

```
ionic cordova prepare android
```

Set the launchMode to `singleTask` so the URL does not trigger a new instance of the app in `platforms/android/app/src/main/AndroidManifest.xml`:

```xml
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:name="com.mydomain.app.MainActivity"
android:label="@string/title_activity_main"
android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBarLaunch">
```

Open your project in Android Studio and run your app.

```
studio platforms/android
```

You'll need to run a couple commands to allow the emulator to communicate with your API and Keycloak.

```
adb reverse tcp:8080 tcp:8080
adb reverse tcp:9080 tcp:9080
```

# Entity Generator

To generate entities, run `yo jhipster-ionic:entity <name>`.
Expand Down

0 comments on commit 2c2bed0

Please sign in to comment.