Skip to content

Commit 739b7ae

Browse files
committed
fix leaking
1 parent 5b08e12 commit 739b7ae

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

OpenFlow/src/Auth.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class Auth {
3737
if (type == "dashboard") cache_seconds = Config.dashboard_credential_cache_seconds;
3838
if (type == "cleanacl") cache_seconds = Config.cleanacl_credential_cache_seconds;
3939
if (seconds < cache_seconds) {
40-
// Logger.instanse.info("Return user " + res.user.username + " from cache");
40+
Logger.instanse.silly("Return user " + res.user.username + " from cache");
4141
return res.user;
4242
}
4343
this.RemoveUser(key, type);
@@ -69,15 +69,15 @@ export class Auth {
6969
public static async RemoveUser(key: string, type: string): Promise<void> {
7070
await semaphore.down();
7171
if (!NoderedUtil.IsNullUndefinded(this.authorizationCache[key + type])) {
72-
Logger.instanse.info("Delete user with key " + key + " from cache");
72+
Logger.instanse.silly("Delete user with key " + key + " from cache");
7373
delete this.authorizationCache[key + type];
7474
}
7575
semaphore.up();
7676
}
7777
public static async AddUser(user: User, key: string, type: string): Promise<void> {
7878
await semaphore.down();
7979
if (NoderedUtil.IsNullUndefinded(this.authorizationCache[key + type])) {
80-
Logger.instanse.info("Adding user " + user.name + " to cache with key " + key);
80+
Logger.instanse.silly("Adding user " + user.name + " to cache with key " + key);
8181
var cuser: CachedUser = new CachedUser(user, user._id, type);
8282
this.authorizationCache[key + type] = cuser;
8383
}

OpenFlow/src/LoginProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ export class LoginProvider {
242242
const [login, password] = Buffer.from(b64auth, "base64").toString().split(':')
243243
if (login && password) {
244244
span.setAttribute("username", login);
245-
let user: User = Auth.getUser(login + ":" + password, "dashboard");
245+
let user: User = Auth.getUser(b64auth, "dashboard");
246246
if (user == null) user = await Auth.ValidateByPassword(login, password, span);
247247
if (user != null) {
248248
const allowed = user.roles.filter(x => x.name == "dashboardusers" || x.name == "admins");
249249
if (allowed.length > 0) {
250250
// Logger.instanse.info("dashboardauth: Authorized " + user.username + " for " + req.url);
251-
Auth.AddUser(user, login + ":" + password, "dashboard");
251+
Auth.AddUser(user, b64auth, "dashboard");
252252
return res.send({
253253
status: "success",
254254
display_status: "Success",

0 commit comments

Comments
 (0)