loopback-component-remote-auth

0.1.1 • Public • Published

RemoteAuthToken

Example Repo: loopback-component-remote-auth-example

Server Install

cd loopback-auth-server-repo
$ npm install loopback-component-remote-auth --save

loopback-auth-server-repo/server/component-config.json

{
...
"loopback-component-remote-auth" : true
...
}

loopback-auth-server-repo/server/model-config.js

....
"User": {
    "dataSource": "db",
    "public": true
},
"AccessToken": {
    "dataSource": "db",
    "public": true
},
"ACL": {
    "dataSource": "db",
    "public": true
},
"RoleMapping": {
    "dataSource": "db",
    "public": true
},
"Role": {
    "dataSource": "db",
    "public": true
}
....

AccessToken

Add to the AccessToken one acl to read the token:

"acls" : [
    .....
    {
      "model" : "AccessToken",
      "property": "findById",
      "accessType": "READ",
      "principalType": "ROLE",
      "principalId": "$owner",
      "permission": "ALLOW"
    }
    .....
]

Client Install

cd loopback-auth-client-repo
$ npm install loopback-component-remote-auth --save

loopback-auth-client-repo/server/component-config.json

{
...
"loopback-component-remote-auth" : true
...
}

loopback-auth-client-repo/server/model-config.js

....
"AccessToken": {
    "dataSource": "auth-server", // rest to loopback-auth-server-repo
    "public": false
},
"ACL": {
    "dataSource": "auth-server", // rest to loopback-auth-server-repo
    "public": false
},
"RoleMapping": {
    "dataSource": "auth-server", // rest to loopback-auth-server-repo
    "public": false
},
"Role": {
    "dataSource": "auth-server", // rest to loopback-auth-server-repo
    "public": false
},
"User": {
    "dataSource": "auth-server", // rest to loopback-auth-server-repo
    "public": false
}
....

License

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i loopback-component-remote-auth

      Weekly Downloads

      8

      Version

      0.1.1

      License

      MIT

      Last publish

      Collaborators

      • waldemar.zahn