Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented 4 flow of authentication #30

Open
wants to merge 67 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
6fa29d7
installed prop-types
yoh1496 Jun 25, 2020
c6c3f1b
Append dummy auth context and dummy page
yoh1496 Jun 25, 2020
e4f9bf8
installed eslint-plugin-react-hooks
yoh1496 Jun 26, 2020
ac9a86c
fix typo
yoh1496 Jun 26, 2020
8127d63
implemented ROPC
yoh1496 Jun 26, 2020
c426134
implemented Personium Auth example
yoh1496 Jun 29, 2020
18ff6dc
installed prop-types
yoh1496 Jun 25, 2020
0f7968b
Append dummy auth context and dummy page
yoh1496 Jun 25, 2020
0695480
installed eslint-plugin-react-hooks
yoh1496 Jun 26, 2020
440656e
fix typo
yoh1496 Jun 26, 2020
9055556
implemented ROPC
yoh1496 Jun 26, 2020
3f58547
implemented Personium Auth example
yoh1496 Jun 29, 2020
c9c27e5
Refactoring
yoh1496 Jun 30, 2020
149878c
npm update
yoh1496 Jun 30, 2020
03b41a5
Merge branch 'feature/auth' of https://github.com/yoh1496/personium-b…
yoh1496 Jun 30, 2020
8be3f4c
modify placeholder of shcema
yoh1496 Jun 30, 2020
6a2ffa0
modify not to hard-code user/pass in config.js
yoh1496 Jun 30, 2020
f6562d6
update README.md
yoh1496 Jun 30, 2020
93faef9
temp
yoh1496 Jun 30, 2020
4ad3a15
implement BarInstallation View
yoh1496 Jul 1, 2020
7ed9207
modify typo
yoh1496 Jul 1, 2020
87a569d
include oauth engine
yoh1496 Jul 2, 2020
484b3c5
implent oAuth
yoh1496 Jul 3, 2020
1810e29
update README.md
yoh1496 Jul 3, 2020
e5fe861
implement auth form in current tab
yoh1496 Jul 6, 2020
10348af
Merge pull request #27 from yoh1496/feature/auth
tochi-y Jul 10, 2020
7b7d3d4
Merge pull request #28 from yoh1496/feature/modify_config
tochi-y Jul 10, 2020
c825892
Bump lodash from 4.17.14 to 4.17.19
dependabot[bot] Jul 17, 2020
b46284c
Merge pull request #29 from yoh1496/feature/boxInstall
tochi-y Jul 20, 2020
92c8c4a
avoid login loop
yoh1496 Jul 27, 2020
ba71788
Fix: documentation link
j1n6 Jul 29, 2020
db76658
Add a missing dependency step
j1n6 Jul 29, 2020
0c0c5d6
Add command for local debug in doc
j1n6 Jul 29, 2020
1436867
append description of editing AppConstant
yoh1496 Jul 30, 2020
ceae585
Merge pull request #32 from personium/j1n6-patch-1
dixonsiu Jul 30, 2020
7d5849f
Apply suggestions from code review
j1n6 Jul 30, 2020
4ab5383
Merge pull request #33 from personium/j1n6-patch-2
dixonsiu Jul 31, 2020
729c6ab
Update README.md
yoh1496 Jul 31, 2020
a60a977
Update README.md
yoh1496 Jul 31, 2020
9b80707
Update README.md
yoh1496 Jul 31, 2020
6b8828d
Update README.md
yoh1496 Jul 31, 2020
62de827
Merge branch 'develop' into modify/readme
yoh1496 Jul 31, 2020
c9be22f
Merge pull request #36 from yoh1496/modify/readme
dixonsiu Jul 31, 2020
e636b7d
Merge pull request #35 from personium/j1n6-patch-3
j1n6 Jul 31, 2020
139f7cf
update folder structure
yoh1496 Sep 29, 2020
d4c1485
Merge pull request #38 from personium/feature/modify_directory
tochi-y Sep 30, 2020
8a7d287
Merge pull request #31 from personium/dependabot/npm_and_yarn/lodash-…
tochi-y Sep 30, 2020
b8b746c
Improve doc: correct AppConstant.js path
j1n6 Nov 18, 2020
f5d64e7
Improve doc: fix the pass variable instruction
j1n6 Nov 18, 2020
fd5a9c8
Merge pull request #40 from personium/j1n6-patch-2
dixonsiu Nov 19, 2020
2288813
Merge pull request #41 from personium/j1n6-patch-3
dixonsiu Nov 19, 2020
1c56b0c
Update README.md
j1n6 Nov 25, 2020
467056f
Added link reference to unit manager
j1n6 Nov 25, 2020
60649c7
add locales and update README
yoh1496 Nov 26, 2020
9a28ee0
Merge pull request #42 from personium/j1n6-patch-2
dixonsiu Nov 30, 2020
7272407
Merge pull request #43 from yoh1496/feature/locales
yoh1496 Jan 8, 2021
d795ebf
update packages and remove eslint-plugin-prettier
yoh1496 May 28, 2021
4eb6984
Merge pull request #52 from yoh1496/purge_eslint_plugin_prettier
tochi-y May 31, 2021
3b33d9f
Using BrowserRouter instead of HashRouter
yoh1496 May 31, 2021
87b50a9
include oauth engine
yoh1496 Jul 2, 2020
448494e
implent oAuth
yoh1496 Jul 3, 2020
f391f5f
update README.md
yoh1496 Jul 3, 2020
2fe3b31
implement auth form in current tab
yoh1496 Jul 6, 2020
36c3c18
avoid login loop
yoh1496 Jul 27, 2020
80b93cb
modify use BrowserRouter
yoh1496 Jun 4, 2021
d5c56ba
Merge branch 'feature/oauth' of https://github.com/yoh1496/personium-…
yoh1496 Jun 4, 2021
31ed602
modify readme.md
yoh1496 Jun 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 18 additions & 32 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true,
env: {
browser: true,
es6: true,
node: true,
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
extends: ['eslint:recommended', 'plugin:react/recommended'],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
"ecmaVersion": 7,
"sourceType": "module"
ecmaVersion: 7,
sourceType: 'module',
},
"plugins": [
"react"
],
"rules": {
"linebreak-style": [
"error",
"unix"
],
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "es5",
}
]
}
};
plugins: ['react', 'react-hooks'],
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'linebreak-style': ['error', 'unix'],
},
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ typings/
src/bar/00_meta/00_manifest.json
src/bar/00_meta/90_rootprops.xml
src/assets/launch.json
src/app/frontend/Constants/AppConstant.js
src/app/engine/auth/acc_info.js

dist
build
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
trailingComma: "es5",
tabWidth: 2,
semi: true,
singleQuote: true,
};
102 changes: 84 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

This repository contains a template application of Personium and deployment tools.

| stuff | libraries |
| :-- | :-- |
| Personium template app | React.js |
| stuff | libraries |
| :---------------------------- | :----------- |
| Personium template app | React.js |
| Personium app deployment tool | gulp, webdav |

You can make `Personium App` ( not `Apps that uses Personium` ) by extending these codes.

["Personium App" and "Apps that uses Personium"](https://personium.io/docs/en/app-developer/)
["Personium App" and "Apps that uses Personium"](https://personium.io/docs/en/app-developer/Personium_Apps/)

## Preaparation for deployment

Expand All @@ -22,15 +22,14 @@ Rename from `config.example.js` to `config.js` and modify it as below.
```js
module.exports = {
personium: {
CELL_NAME: '<CELL_NAME>', // A name of Application Cell
CELL_FQDN: '<CELL_FQDN>', // FQDN of Application Cell
CELL_ADMIN: '<ADMIN_USERNAME>', // Username of user with admin role.
CELL_ADMIN_PASS: '<ADMIN_PASSWORD>', // Password of user with admin role.
// ...
}
CELL_NAME: "<CELL_NAME>", // A name of Application Cell
CELL_FQDN: "<CELL_FQDN>", // FQDN of Application Cell
// ...
},
};
```

- `<CELL_NAME>`, the application Cell's name ( like `app-template` )
- `<CELL_FQDN>` reveals application cell's FQDN ( like `app-template.demo.personium.io` )

#### Config: Application Cell
Expand All @@ -47,6 +46,19 @@ Rename from `src/assets/launch.example.json` to `src/assets/launch.json` and mod
}
```

#### Config: Authentication Setting

Rename from `src/app/engine/auth/acc_info.example.js` to `src/app/engine/auth/acc_info.js` and modify it as below.

```javascript
var appCellUrl = '<CELL_URL>'; // for example: https://stg-demo.personium.io/appCellName/ or https://appCellName.stg-demo.personium.io/
var appUserId = '***';
var appUserPass = '***';
```

- `<CELL_URL>` reveals URL of App Cell ( scheme + `<CELL_FQDN>` + `/` ).
- `appUserId` and `appUserPass` are no longer used.

#### Config: Box in User Cell I

Rename from `src/bar/00_meta/00_manifest.example.json` to `src/bar/00_meta/00_manifest.json` and modify it as below.
Expand All @@ -67,8 +79,29 @@ Rename from `src/bar/00_meta/00_manifest.example.json` to `src/bar/00_meta/00_ma

Rename from `src/bar/00_meta/90_rootprops.example.xml` to `src/bar/00_meta/90_rootprops.xml`. ( without modifing )

#### Config: Application Settings

Rename the file from `src/app/frontend/Constants/AppConstant.example.js` to `src/app/frontend/Constants/AppConstant.js` and modify its contents as below.

```js
export const AppConstant = {
cellUrl: '<CELL_URL>',
installBoxName: '<BOX_NAME>',
barFileUrl: '<BAR_FILE_URL>',
};
```

- `<BOX_NAME>`, the default target Box name in user Cell. It is often set same as `<CELL_NAME>` typically.
- `<BAR_FILE_URL>` , the URL of the `bar` file to be built in next step. It is often placed somewhere public in App Cell.

### Build

#### Install Node.js dependencies

```bash
npm install
```

#### Building `bar` file

Build `bar` file with below command.
Expand All @@ -91,6 +124,14 @@ npm run build

This command build application into `build` folder.

### Develop and Debug

The following command will start a localhost [webpack](https://webpack.js.org/) server on port `8080` for application development.

```bash
npm run debug
```

### Deploy

#### Deploying built stuff
Expand All @@ -101,12 +142,40 @@ Upload built stuff ( Apps and static-files ) with below command.
npm run deploy
```

This command refers credentials in env value. Make sure below env value are set before try this code.

| ValueName | Description |
| :--------------- | :---------------------------------------------- |
| `PERSONIUM_USER` | Username of admin user in your application cell |
| `PERSONIUM_PASS` | Password of admin user in your application cell |

You can run this command with setting env value like below command.

In Linux,

```bash
PERSONIUM_USER=*** PERSONIUM_PASS=*** npm run deploy
```

In Windows,

```cmd
set PERSONIUM_USER=*** && set PERSONIUM_PASS=*** && npm run deploy
```

#### Configure ACL

Configurign ACL is conducted manually.
Configurign ACL is conducted manually in the [Unit Manager](https://github.com/personium/app-uc-unit-manager) administration page.

1. Set `exec` to `all(anyone)` in `front` service.
1. Set `exec` to `all(anyone)` in `front` and `auth` service.
1. Set `read` to `all(anyone)` in `public` folder.
1. Set `read` to `all(anyone)` in `locales` folder.

#### Create Application authentication account

`tokenAcc` account is used for application authentication.

Create an account named `tokenAcc` and set password as you like.

#### Make application specs public

Expand All @@ -128,13 +197,10 @@ In Home App of user who installs `bar` file above can launch this application by
The entrypoint of this application is `src/app/frontend/index.js`.

```es6
import React from 'react';
import ReactDOM from 'react-dom';
import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(
<h1>Hello React!</h1>,
document.getElementById('root')
);
ReactDOM.render(<h1>Hello React!</h1>, document.getElementById("root"));
```

So, you can implement SPA application with React.js by modifing this codes.
29 changes: 25 additions & 4 deletions config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ module.exports = {
personium: {
CELL_NAME: '<CELL_NAME>',
CELL_FQDN: '<CELL_FQDN>',
CELL_ADMIN: '<ADMIN_USERNAME>',
CELL_ADMIN_PASS: '<ADMIN_PASSWORD>',
CELL_ADMIN: process.env.PERSONIUM_USER,
CELL_ADMIN_PASS: process.env.PERSONIUM_PASS,
DIRECTORY_MAPPING: [
{
filePattern: ['src/app/engine/**/*', '!src/app/engine/**/*.example.*'],
srcDir: 'src/app/engine',
filePattern: [
'src/app/engine/front/*',
'!src/app/engine/front/*.example.*',
],
srcDir: 'src/app/engine/front',
dstDir: 'front',
resourceType: 'service',
meta: {
Expand All @@ -18,6 +21,24 @@ module.exports = {
},
},
},
{
filePattern: [
'src/app/engine/auth/*',
'!src/app/engine/auth/*.example.*',
],
srcDir: 'src/app/engine/auth',
dstDir: 'auth',
resourceType: 'service',
meta: {
language: 'JavaScript',
subject: 'tokenAcc',
endPoints: {
start_oauth2: 'start_oauth2.js',
receive_redirect: 'receive_redirect.js',
refreshProtectedBoxAccessToken: 'refreshProtectedBoxAccessToken.js',
},
},
},
{
filePattern: [
'src/app/public',
Expand Down
Loading