Skip to content

Commit 88a2524

Browse files
authored
Merge pull request openiap#202 from skadefro/open-rpa-master
close 1.4.5
2 parents 358a822 + 71ccb45 commit 88a2524

9 files changed

Lines changed: 20 additions & 668 deletions

OpenFlow/src/OAuthProvider.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -736,25 +736,35 @@ export class Account {
736736
claims() {
737737
return this.user;
738738
}
739-
static async findAccount(ctx: KoaContextWithOIDC, id): Promise<any> {
740-
let acc = await DBHelper.FindById(id, undefined, undefined);
739+
static async findAccount(ctx: KoaContextWithOIDC, id, test): Promise<any> {
740+
let acc = await DBHelper.memoryCache.get("oidc" + id);
741+
if (acc == null) {
742+
acc = await DBHelper.FindById(id, undefined, undefined);
743+
}
741744
// let acc = Auth.getUser(id, "oidc");
742745
// if (!acc) {
743746
// const user = await DBHelper.FindById(id, undefined, undefined);
744747
// await Auth.AddUser(user, id, "oidc")
745748
// }
746-
return new Account(id, TokenUser.From(acc));
749+
var res = new Account(id, TokenUser.From(acc))
750+
return res;
747751
}
748752
static AddAccount(tuser: TokenUser, client: any) {
749753
try {
750754
let role = client.defaultrole;
751755
const keys: string[] = Object.keys(client.rolemappings);
756+
Logger.instanse.info("[OAuth][" + tuser.username + "] Lookup roles for " + tuser.username);
752757
for (let i = 0; i < keys.length; i++) {
753-
if (tuser.HasRoleName(keys[i])) role = client.rolemappings[keys[i]];
758+
if (tuser.HasRoleName(keys[i])) {
759+
Logger.instanse.info("[OAuth][" + tuser.username + "] User has role " + keys[i] + " set role " + client.rolemappings[keys[i]]);
760+
role = client.rolemappings[keys[i]];
761+
}
754762
}
755763
(tuser as any).role = role;
756-
DBHelper.DeleteKey("user" + tuser._id);
757-
return new Account(tuser._id, TokenUser.From(tuser));
764+
DBHelper.memoryCache.set("oidc" + tuser._id, tuser);
765+
// DBHelper.DeleteKey("user" + tuser._id);
766+
var res = new Account(tuser._id, tuser);
767+
return res;
758768
// let acc = Auth.getUser(tuser._id, "oidc");
759769
// if (!acc) {
760770
// let role = client.defaultrole;

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.4
1+
1.4.5

docker-compose-traefik-letsencrypt-dns01.yml

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)