New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kauth-sdk-node

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kauth-sdk-node - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

lib/common/http/request/kflow.d.ts

2

lib/authenticator/authenticator.js

@@ -29,3 +29,3 @@ "use strict";

const result = await this.kauthApi.googleAuthenticate(request);
const authenticationInformation = new _google.GoogleAuthentcationInformation();
const authenticationInformation = new _google.GoogleAuthenticationInformation();
authenticationInformation.primaryPrincipal = result.primaryPrincipal;

@@ -32,0 +32,0 @@ authenticationInformation.principal = result.principal;

@@ -17,3 +17,3 @@ import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation } from './base';

}
export declare class GoogleAuthentcationInformation implements AuthenticationInformation {
export declare class GoogleAuthenticationInformation implements AuthenticationInformation {
primaryPrincipal: PrimaryPrincipal;

@@ -20,0 +20,0 @@ principal: GooglePrincipal;

@@ -6,3 +6,3 @@ "use strict";

});
exports.GoogleAuthentcationInformation = exports.GoogleCredential = exports.GooglePrincipal = void 0;
exports.GoogleAuthenticationInformation = exports.GoogleCredential = exports.GooglePrincipal = void 0;

@@ -47,3 +47,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

class GoogleAuthentcationInformation {
class GoogleAuthenticationInformation {
constructor() {

@@ -59,2 +59,2 @@ _defineProperty(this, "primaryPrincipal", void 0);

exports.GoogleAuthentcationInformation = GoogleAuthentcationInformation;
exports.GoogleAuthenticationInformation = GoogleAuthenticationInformation;
import { AuthenticationInformation } from './base';
import { GoogleAuthentcationInformation } from './google';
import { GoogleAuthenticationInformation } from './google';
import { MoziAuthenticationInformation } from './mozi';

@@ -23,3 +23,3 @@ import { KauthApi } from '../common/http/kauth';

append(information: AuthenticationInformation, claims: Claims): boolean;
transform(claims: Claims): Promise<GoogleAuthentcationInformation>;
transform(claims: Claims): Promise<GoogleAuthenticationInformation>;
}

@@ -26,0 +26,0 @@ export declare class MoziAuthenticationInfoManager implements AuthenticationInfoManger {

@@ -67,3 +67,3 @@ "use strict";

append(information, claims) {
if (information instanceof _google.GoogleAuthentcationInformation) {
if (information instanceof _google.GoogleAuthenticationInformation) {
const specifiedInformation = information;

@@ -98,3 +98,3 @@ const id = specifiedInformation.primaryPrincipal.id;

principal.emailVerified = rawPrincipal.emailVerified;
const authenticationInformation = new _google.GoogleAuthentcationInformation();
const authenticationInformation = new _google.GoogleAuthenticationInformation();
authenticationInformation.primaryPrincipal = primaryPrincipal;

@@ -101,0 +101,0 @@ authenticationInformation.principal = principal;

@@ -0,48 +1,3 @@

import { KauthMoziAuthenticationInformation, KauthGoogleAuthenticationInformation, KauthPermission } from './response/kauth';
import { KauthConfig } from '../config/config';
interface KauthPrimaryPrincipal {
id: number;
name: string;
email: string;
status: number;
}
interface KauthGooglePrincipal {
sub: string;
name: string;
givenName: string;
familyName: string;
picture: string;
email: string;
emailVerified: boolean;
locale: string;
}
interface KauthGoogleCredential {
accessToken: string;
expiresIn: number;
refreshToken: string;
}
interface KauthGoogleAuthenticationInformation {
primaryPrincipal: KauthPrimaryPrincipal;
principal: KauthGooglePrincipal;
credential: KauthGoogleCredential;
}
interface KauthMoziPrincipal {
account: string;
employeeCode: string;
lastName: string;
namespace: string;
nickNameCn: string;
openid: string;
realmId: number;
realmName: string;
}
interface KauthMoziCredential {
accessToken: string;
expiresIn: number;
refreshToken: string;
}
interface KauthMoziAuthenticationInformation {
primaryPrincipal: KauthPrimaryPrincipal;
principal: KauthMoziPrincipal;
credential: KauthMoziCredential;
}
export declare class KauthApi {

@@ -63,4 +18,4 @@ private kauthOrigin;

getGoogleAuthenticationInformation(id: number): Promise<KauthGoogleAuthenticationInformation>;
listPermissionsByUserId(id: number): Promise<KauthPermission[]>;
private filterResponse;
}
export {};

@@ -31,4 +31,5 @@ "use strict";

async moziAuthenticate(request) {
const response = await (0, _nodeFetch.default)(this.kauthOrigin + '/api/authenticator/mozi/authenticate', {
method: 'post',
const url = this.kauthOrigin + '/api/authenticator/mozi/authenticate';
const response = await (0, _nodeFetch.default)(url, {
method: 'POST',
body: JSON.stringify(request),

@@ -43,3 +44,4 @@ headers: {

async getMoziAuthenticationInformation(id) {
const response = await (0, _nodeFetch.default)(this.kauthOrigin + '/api/authenticator/mozi/authenticationInformation?id=' + id);
const url = `${this.kauthOrigin}/api/authenticator/mozi/authenticationInformation?id=${id}`;
const response = await (0, _nodeFetch.default)(url);
return this.filterResponse(response);

@@ -49,3 +51,4 @@ }

async googleAuthorizeURL(callback) {
const response = await (0, _nodeFetch.default)(this.kauthOrigin + '/api/authenticator/google/authorizeUrl?callback=' + callback);
const url = `${this.kauthOrigin}/api/authenticator/google/authorizeUrl?callback=${callback}`;
const response = await (0, _nodeFetch.default)(url);
return this.filterResponse(response);

@@ -55,4 +58,5 @@ }

async googleAuthenticate(request) {
const response = await (0, _nodeFetch.default)(this.kauthOrigin + '/api/authenticator/google/authenticate', {
method: 'post',
const url = this.kauthOrigin + '/api/authenticator/google/authenticate';
const response = await (0, _nodeFetch.default)(url, {
method: 'POST',
body: JSON.stringify(request),

@@ -67,6 +71,13 @@ headers: {

async getGoogleAuthenticationInformation(id) {
const response = await (0, _nodeFetch.default)(this.kauthOrigin + '/api/authenticator/google/authenticationInformation?id=' + id);
const url = `${this.kauthOrigin}/api/authenticator/google/authenticationInformation?id=${id}`;
const response = await (0, _nodeFetch.default)(url);
return this.filterResponse(response);
}
async listPermissionsByUserId(id) {
const url = `${this.kauthOrigin}/api/backend/listPermissionsByUserId?id=${id}`;
const response = await (0, _nodeFetch.default)(url);
return this.filterResponse(response);
}
async filterResponse(response) {

@@ -73,0 +84,0 @@ if (response.status != 200) {

@@ -1,1 +0,89 @@

"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.KflowApi = void 0;
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class KflowApi {
constructor({
kflowOrigin
}) {
_defineProperty(this, "kflowOrigin", void 0);
this.kflowOrigin = kflowOrigin || '';
}
async startProcessInstanceByKey(userId, request) {
const url = this.kflowOrigin + '/api/kflow/process';
const response = await (0, _nodeFetch.default)(url, {
method: 'POST',
body: JSON.stringify(request),
headers: {
'Content-Type': 'application/json',
'x-kauth-user-id': userId
}
});
return this.filterResponse(response);
}
async completeTaskService(userId, request) {
const url = this.kflowOrigin + '/api/kflow/serviceTask';
const response = await (0, _nodeFetch.default)(url, {
method: 'POST',
body: JSON.stringify(request),
headers: {
'Content-Type': 'application/json',
'x-kauth-user-id': userId
}
});
return this.filterResponse(response);
}
async deleteProcessInstance(userId, instanceId, reason) {
const url = `${this.kflowOrigin}/api/kflow/process?instanceId=${instanceId}&reason=${reason}`;
const response = await (0, _nodeFetch.default)(url, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
'x-kauth-user-id': userId
}
});
return this.filterResponse(response);
}
async getStateMachineAndNodes(userId, instanceId) {
const url = `${this.kflowOrigin}/api/kflow/stateMachine/instance/${instanceId}`;
const response = await (0, _nodeFetch.default)(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'x-kauth-user-id': userId
}
});
return this.filterResponse(response);
}
async filterResponse(response) {
if (response.status != 200) {
throw new Error('internal server error');
}
const json = await response.json();
if (json.status !== 0) {
throw new Error(json.message);
}
return json.body;
}
}
exports.KflowApi = KflowApi;
{
"name": "kauth-sdk-node",
"version": "0.0.5",
"version": "0.0.6",
"description": "",

@@ -12,3 +12,4 @@ "main": "index.js",

"build": "npm run clean && npm run build:types && gulp",
"clean": "rimraf types lib esm dist"
"clean": "rimraf types lib esm dist",
"watch": "gulp watch"
},

@@ -15,0 +16,0 @@ "author": "",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc