v0.5.155: src/auth.js переведён на v2/config IAM_API_BASE
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.154",
|
"version": "0.5.155",
|
||||||
"description": "IP WhiteList microservice for cloud provider",
|
"description": "IP WhiteList microservice for cloud provider",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+4
-3
@@ -25,7 +25,8 @@ const jwt = require('jsonwebtoken');
|
|||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const { IAM_API_URL } = require('./config');
|
const { iamApiBase } = require('../v2/src/config');
|
||||||
|
const IAM_API_URL = iamApiBase;
|
||||||
|
|
||||||
// ── Конфигурация из окружения ────────────────────────────────────────────────
|
// ── Конфигурация из окружения ────────────────────────────────────────────────
|
||||||
const ISSUER = process.env.JWT_ISSUER || 'mock-auth-api';
|
const ISSUER = process.env.JWT_ISSUER || 'mock-auth-api';
|
||||||
@@ -286,7 +287,7 @@ function verifyAnyToken(token, devMode) {
|
|||||||
*/
|
*/
|
||||||
async function fetchIamUser(token) {
|
async function fetchIamUser(token) {
|
||||||
const raw = await new Promise((resolve, reject) => {
|
const raw = await new Promise((resolve, reject) => {
|
||||||
const url = new URL(IAM_API_URL + '/api/v1/auth/user');
|
const url = new URL(IAM_API_URL + '/auth/user');
|
||||||
const lib = url.protocol === 'https:' ? https : http;
|
const lib = url.protocol === 'https:' ? https : http;
|
||||||
const req = lib.request({
|
const req = lib.request({
|
||||||
hostname: url.hostname,
|
hostname: url.hostname,
|
||||||
@@ -343,7 +344,7 @@ async function fetchIamUser(token) {
|
|||||||
async function switchProfile(token, profileId) {
|
async function switchProfile(token, profileId) {
|
||||||
const body = JSON.stringify({ profile_id: profileId });
|
const body = JSON.stringify({ profile_id: profileId });
|
||||||
const raw = await new Promise((resolve, reject) => {
|
const raw = await new Promise((resolve, reject) => {
|
||||||
const url = new URL(IAM_API_URL + '/api/v1/user/switch-profile');
|
const url = new URL(IAM_API_URL + '/user/switch-profile');
|
||||||
const lib = url.protocol === 'https:' ? https : http;
|
const lib = url.protocol === 'https:' ? https : http;
|
||||||
const req = lib.request({
|
const req = lib.request({
|
||||||
hostname: url.hostname,
|
hostname: url.hostname,
|
||||||
|
|||||||
Reference in New Issue
Block a user