Commit 6d89e780 authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

use generateAuditRecord from npmjs

parent 833d97b0
export declare const getIdentity: () => Promise<any>;
export default getIdentity;
import soap from './soap';
import config from '../config.json'; //TODO replace with args
export const getIdentity = async () => {
try {
const s = new soap(config.test.wsdl, config.test.user, config.test.pass);
const Identity = await s.getIdentity();
return Identity;
}
catch (error) {
throw (error);
}
};
export default getIdentity;
import soap from 'soap';
declare class Soap {
private _client;
private _wsdl;
private _username;
private _password;
constructor(wsdl: string, username: string, password: string);
init(): Promise<soap.Client>;
getIdentity(): Promise<any>;
}
export default Soap;
import soap from 'soap';
import { generateAuditRecord } from '@digigov-oss/gsis-audit-record-db';
class Soap {
_client;
_wsdl;
_username;
_password;
constructor(wsdl, username, password) {
this._wsdl = wsdl;
this._username = username;
this._password = password;
}
async init() {
try {
const client = await soap.createClientAsync(this._wsdl, {
wsdl_headers: {
'Authorization': 'Basic ' + Buffer.from(`${this._username}:${this._password}`).toString('base64'),
},
});
this._client = client;
return client;
}
catch (e) {
throw e;
}
}
async getIdentity() {
try {
const client = await this.init();
var options = {
hasNonce: true,
actor: 'actor'
};
var wsSecurity = new soap.WSSecurity(this._username, this._password, options);
client.setSecurity(wsSecurity);
const auditRecord = await generateAuditRecord({});
const args = {
auditRecord: auditRecord,
getNncIdentityInputRecord: {
afm: "019285930"
}
};
const result = await client.getNncIdentityAsync(args);
return result[0].getNncIdentityOutputRecord;
}
catch (e) {
throw e;
}
}
}
export default Soap;
......@@ -8,7 +8,7 @@
},
"author": "Panagiotis Skarvelis <pskarvelis@admin.grnet.gr>",
"dependencies": {
"gsis-audit-record-db": "git+https://gitlab.grnet.gr/digigov/auditRecordDB.git",
"@digigov-oss/gsis-audit-record-db": "^1.0.1",
"soap": "^0.43.0"
},
"repository": {
......
import soap from 'soap';
import {generateAuditRecord} from 'gsis-audit-record-db';
import {generateAuditRecord} from '@digigov-oss/gsis-audit-record-db';
class Soap {
private _client: any;
......
......@@ -14,6 +14,11 @@
dependencies:
"@cspotcode/source-map-consumer" "0.8.0"
"@digigov-oss/gsis-audit-record-db@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@digigov-oss/gsis-audit-record-db/-/gsis-audit-record-db-1.0.1.tgz#103d181f2fbccb6cca1d058c498644deb9cbaa0a"
integrity sha512-4kmkX/kQBM6RexbmTY2RLpRhQHHkXcxgKpKDuS+8zx5MenLbN9Vwz69AG9TRUS20e4/vZzMOd4veGv2QczOmPA==
"@tsconfig/node10@^1.0.7":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9"
......@@ -115,12 +120,6 @@ get-stream@^6.0.1:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
"gsis-audit-record-db@git+https://gitlab.grnet.gr/digigov/auditRecordDB.git":
version "1.0.1"
resolved "git+https://gitlab.grnet.gr/digigov/auditRecordDB.git#c550dc8417adba8494adf9ba59d1d361cf5a76fe"
dependencies:
uuid "^8.3.2"
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment