Skip to content

Commit

Permalink
Merge pull request e-mission#465 from shankari/fix_auth_prompt
Browse files Browse the repository at this point in the history
Fix connection config samples
  • Loading branch information
shankari authored Sep 20, 2018
2 parents b4b2749 + 11c1dfa commit f3918fc
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 19 deletions.
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,9 @@ A lot of the visualizations that we display in the phone client come from the se
are available in the [e-mission-server README](https://github.com/e-mission/e-mission-server/blob/master/README.md).
In order to make end to end testing easy, if the local server is started on a HTTP (versus HTTPS port), it is in development mode and it has effectively no authentication. It expects the user token to contain the user email *in plaintext*.
By default, the phone app connects to the local server (localhost on iOS,
[10.0.2.2 on
android](https://stackoverflow.com/questions/5806220/how-to-connect-to-my-http-localhost-web-server-from-android-emulator-in-eclips))
by default. To connect to a different server, or to use a different
authentication method, you need to create a `www/json/connectionConfig.json`
file. You can find sample files for connecting physical devices to the local
server (`www/json/connectionConfig.physical_device2localhost.json.sample`), and
to production (www/json/connectionConfig.production.json.sample).
So when the phone app connects to a server that is in development mode, it is also in development mode. This means that any user email can be entered without a password. Developers should use one of the emails that they loaded test data for in step (3) above. So if the test data loaded was with `-u shankari@eecs.berkeley.edu`, then the login email for the phone app would also be `shankari@eecs.berkeley.edu`.
In order to make end to end testing easy, if the local server is started on a HTTP (versus HTTPS port), it is in development mode. By default, the phone app connects to the local server (localhost on iOS, [10.0.2.2 on android](https://stackoverflow.com/questions/5806220/how-to-connect-to-my-http-localhost-web-server-from-android-emulator-in-eclips)) with the `prompted-auth` authentication method. To connect to a different server, or to use a different authentication method, you need to create a `www/json/connectionConfig.json` file. More details on configuring authentication [can be found in the docs](https://github.com/e-mission/e-mission-docs/docs/e-mission-common/configuring_authentication.md).
One advantage of using `skip` authentication in development mode is that any user email can be entered without a password. Developers can use one of the emails that they loaded test data for in step (3) above. So if the test data loaded was with `-u shankari@eecs.berkeley.edu`, then the login email for the phone app would also be `shankari@eecs.berkeley.edu`.
Updating the e-mission-* plugins or adding new plugins
---
Expand Down
18 changes: 18 additions & 0 deletions www/json/connectionConfig.openid.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"connectUrl": "<e-mission server url, including host and port>",
"android": {
"auth": {
"method": "openid-authutil",
"discoveryURI": "<config_url>, similar to https://accounts.open-to-all.com/auth/realms/OpenToAll/",
"clientID": "<audience>, similar to emission-mobile-dev",
"scope": "openid email profile offline_access"
}
},
"ios": {
"auth": {
"method": "openid-authutil",
"discoveryURI": "<config_url>, similar to https://accounts.open-to-all.com/auth/realms/OpenToAll/",
"clientID": "<audience>, similar to emission-mobile-dev"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"connectUrl": "http://<your laptop ip>:8080",
"android": {
"auth": {
"method": "dummy-dev",
"method": "prompted-auth",
"clientID": "ignored"
}
},
"ios": {
"auth": {
"method": "dummy-dev",
"method": "prompted-auth",
"clientID": "ignored"
}
}
Expand Down
15 changes: 15 additions & 0 deletions www/json/connectionConfig.token_list.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"connectUrl": "<e-mission server url, including host and port>",
"android": {
"auth": {
"method": "prompted-auth",
"prompt": "Enter your unique token"
}
},
"ios": {
"auth": {
"method": "prompted-auth",
"prompt": "Enter your unique token"
}
}
}
10 changes: 5 additions & 5 deletions www/json/connectionConfig.zephyr.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"connectUrl": "http://34.204.93.200",
"connectUrl": "http://cardshark.cs.berkeley.edu",
"android": {
"auth": {
"method": "dummy-dev",
"clientID": "ignored"
"method": "prompted-auth",
"prompt": "Enter a unique identifier for your device"
}
},
"ios": {
"auth": {
"method": "dummy-dev",
"clientID": "ignored"
"method": "prompted-auth",
"prompt": "Enter a unique identifier for your device"
}
}
}

0 comments on commit f3918fc

Please sign in to comment.