Skip to content

Commit d759e90

Browse files
committed
remove bcrypt
Signed-off-by: Utkarsh Srivastava <srivastavautkarsh8097@gmail.com>
1 parent 0bf3bf6 commit d759e90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+375
-1106
lines changed

package-lock.json

Lines changed: 13 additions & 387 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"@smithy/node-http-handler": "3.3.3",
8484
"ajv": "8.17.1",
8585
"aws-sdk": "2.1692.0",
86-
"bcrypt": "5.1.1",
8786
"big-integer": "1.6.52",
8887
"bindings": "1.5.0",
8988
"chance": "1.1.13",

src/agent/block_store_speed.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ const config = require('../../config');
1111
const dotenv = require('../util/dotenv');
1212
const Speedometer = require('../util/speedometer');
1313
const { RPC_BUFFERS } = require('../rpc');
14+
const { make_auth_token } = require('../server/common_services/auth_server');
1415

1516
dotenv.load();
1617

17-
argv.email = argv.email || 'demo@noobaa.com';
18-
argv.password = argv.password || 'DeMo1';
1918
argv.system = argv.system || 'demo';
2019
argv.address = argv.address || '';
2120
argv.forks = argv.forks || 1;
@@ -37,16 +36,18 @@ if (argv.forks > 1 && cluster.isMaster) {
3736

3837
async function main() {
3938
console.log('ARGS', argv);
39+
const token = argv.token || make_auth_token({
40+
system: argv.system,
41+
role: 'admin',
42+
email: argv.email,
43+
});
44+
4045
const rpc = api.new_rpc();
4146
const client = rpc.new_client();
4247
const signal_client = rpc.new_client();
4348
const n2n_agent = rpc.register_n2n_agent(((...args) => signal_client.node.n2n_signal(...args)));
4449
n2n_agent.set_any_rpc_address();
45-
await client.create_auth_token({
46-
email: argv.email,
47-
password: argv.password,
48-
system: argv.system,
49-
});
50+
client.options.auth_token = token;
5051
await Promise.all(Array(argv.concur).fill(0).map(() => worker(client)));
5152
process.exit();
5253
}

src/api/account_api.js

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ module.exports = {
2121
method: 'POST',
2222
params: {
2323
type: 'object',
24-
required: ['name', 'email', 'has_login', 's3_access'],
24+
required: ['name', 'email', 's3_access'],
2525
properties: {
2626
name: { $ref: 'common_api#/definitions/account_name' },
2727
email: { $ref: 'common_api#/definitions/email' },
2828
password: { $ref: 'common_api#/definitions/password' },
2929
must_change_password: {
3030
type: 'boolean',
3131
},
32-
has_login: {
32+
has_login: { // DEPRECATED - TO BE REMOVED
3333
type: 'boolean'
3434
},
3535
s3_access: {
@@ -216,26 +216,6 @@ module.exports = {
216216
}
217217
},
218218

219-
reset_password: {
220-
doc: 'Reset an account password',
221-
method: 'PUT',
222-
params: {
223-
type: 'object',
224-
required: ['email', 'verification_password', 'password'],
225-
properties: {
226-
email: { $ref: 'common_api#/definitions/email' },
227-
verification_password: { $ref: 'common_api#/definitions/password' },
228-
password: { $ref: 'common_api#/definitions/password' },
229-
must_change_password: {
230-
type: 'boolean'
231-
}
232-
},
233-
},
234-
auth: {
235-
system: 'admin'
236-
}
237-
},
238-
239219
generate_account_keys: {
240220
doc: 'Generate new account keys',
241221
method: 'PUT',
@@ -638,7 +618,7 @@ module.exports = {
638618
definitions: {
639619
account_info: {
640620
type: 'object',
641-
required: ['name', 'email', 'has_login', 'has_s3_access'],
621+
required: ['name', 'email', 'has_s3_access'],
642622
properties: {
643623
name: { $ref: 'common_api#/definitions/account_name' },
644624
email: { $ref: 'common_api#/definitions/email' },
@@ -648,7 +628,7 @@ module.exports = {
648628
is_external: {
649629
type: 'boolean'
650630
},
651-
has_login: {
631+
has_login: { // DEPRECATED - TO BE REMOVED
652632
type: 'boolean',
653633
},
654634
next_password_change: {

src/api/auth_api.js

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,6 @@ module.exports = {
1414

1515
methods: {
1616

17-
create_auth: {
18-
doc: 'Authenticate account with credentials, ' +
19-
'and returns an access token. ' +
20-
'supply a system name to create a token for acting on the system.',
21-
method: 'POST',
22-
params: {
23-
type: 'object',
24-
// required: [],
25-
properties: {
26-
email: {
27-
doc: 'If email is provided the new authorization will refer to it. ' +
28-
'If no email, the currently authorized account will be used.',
29-
$ref: 'common_api#/definitions/email',
30-
},
31-
password: {
32-
doc: 'If password is supplied then the email will be verified using it. ' +
33-
'If no password then the currently authorized account ' +
34-
'should be permitted to delegate such authorization (e.g. admin).',
35-
$ref: 'common_api#/definitions/password',
36-
},
37-
authorized_by: {
38-
type: 'string',
39-
enum: [
40-
'noobaa',
41-
'oauth'
42-
]
43-
},
44-
system: {
45-
type: 'string',
46-
},
47-
role: {
48-
type: 'string',
49-
},
50-
extra: {
51-
type: 'object',
52-
additionalProperties: true,
53-
properties: {}
54-
},
55-
expiry: {
56-
type: 'integer',
57-
doc: 'Number of seconds before the authentication expires',
58-
},
59-
},
60-
},
61-
reply: {
62-
type: 'object',
63-
required: ['token', 'info'],
64-
properties: {
65-
token: {
66-
type: 'string',
67-
},
68-
info: {
69-
$ref: '#/definitions/auth_info'
70-
}
71-
}
72-
},
73-
auth: {
74-
account: false,
75-
system: false,
76-
anonymous: true,
77-
}
78-
},
79-
8017
create_k8s_auth: {
8118
doc: 'Authenticate a k8s account using an OAuth grant code and return an access token.',
8219
method: 'POST',

src/cmd/api.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dbg.original_console();
1111
const util = require('util');
1212
const minimist = require('minimist');
1313
const api = require('../api');
14+
const { make_auth_token } = require('../server/common_services/auth_server');
1415

1516
const HELP = `
1617
Help:
@@ -39,7 +40,8 @@ Options:
3940
4041
--address <url> (default per api type) Set the address of the rpc server ()
4142
--debug <level> (default 0) Increase debug level
42-
--json Output raw json instead of printaable
43+
--token <token> Token to authorize the request
44+
--json Output raw json instead of printaable
4345
`;
4446

4547
function print_usage() {
@@ -58,6 +60,12 @@ async function main(argv = minimist(process.argv.slice(2))) {
5860
const debug_level = Number(argv.debug) || 5;
5961
dbg.set_module_level(debug_level, 'core');
6062
}
63+
const token = argv.token || make_auth_token({
64+
system: process.env.CREATE_SYS_NAME,
65+
role: 'admin',
66+
email: process.env.CREATE_SYS_EMAIL
67+
});
68+
6169
const address = argv.address || 'wss://localhost:5443';
6270
const api_name = String(argv._[0] || '');
6371
const method_name = String(argv._[1] || '');
@@ -68,11 +76,7 @@ async function main(argv = minimist(process.argv.slice(2))) {
6876
const final_api_name = api_name.endsWith('_api') ? api_name.slice(0, -4) : api_name;
6977
const rpc = api.new_rpc();
7078
const client = rpc.new_client();
71-
await client.create_auth_token({
72-
system: process.env.CREATE_SYS_NAME,
73-
email: process.env.CREATE_SYS_EMAIL,
74-
password: process.env.CREATE_SYS_PASSWD,
75-
});
79+
client.options.auth_token = token;
7680
const res = await client[final_api_name][method_name](params, { address });
7781
if (argv.json) {
7882
console.log(JSON.stringify(res));

src/cmd/backingstore.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const Agent = require('../agent/agent');
1616
const fs_utils = require('../util/fs_utils');
1717
const nb_native = require('../util/nb_native');
1818
const json_utils = require('../util/json_utils');
19+
const { make_auth_token } = require('../server/common_services/auth_server');
1920

2021
const HELP = `
2122
Help:
@@ -101,10 +102,10 @@ async function run_backingstore(storage_path, address, port, pool_name) {
101102
if (!fs.existsSync(token_path)) {
102103
const rpc = api.new_rpc();
103104
const client = rpc.new_client({ address });
104-
await client.create_auth_token({
105+
client.options.auth_token = make_auth_token({
105106
system: process.env.CREATE_SYS_NAME,
106-
email: process.env.CREATE_SYS_EMAIL,
107-
password: process.env.CREATE_SYS_PASSWD,
107+
role: 'admin',
108+
email: process.env.CREATE_SYS_EMAIL
108109
});
109110
const install_string = await client.pool.get_hosts_pool_agent_config({ name: pool_name });
110111
const install_conf = JSON.parse(Buffer.from(install_string, 'base64').toString());

src/rpc/rpc_schema.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,6 @@ class RpcSchema {
144144
const client_proto = {
145145
RPC_BUFFERS,
146146

147-
async create_auth_token(params) {
148-
const res = await this.auth.create_auth(params);
149-
this.options.auth_token = res.token;
150-
return res;
151-
},
152-
153147
async create_access_key_auth(params) {
154148
const res = await this.auth.create_access_key_auth(params);
155149
this.options.auth_token = res.token;

src/sdk/nb.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ interface APIClient {
676676

677677
RPC_BUFFERS: symbol;
678678

679-
create_auth_token(params: APIParams): Promise<object>;
680679
create_access_key_auth(params: APIParams): Promise<object>;
681680
create_k8s_auth(params: APIParams): Promise<object>;
682681
}

0 commit comments

Comments
 (0)