diff --git a/clients/typescript/client-cwe/README.md b/clients/typescript/client-cwe/README.md index a7cc0e24..f63626fa 100644 --- a/clients/typescript/client-cwe/README.md +++ b/clients/typescript/client-cwe/README.md @@ -34,7 +34,7 @@ import { AuthProvider } from '@affinidi/test-auth-provider'; const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/clients/typescript/client-iam/README.md b/clients/typescript/client-iam/README.md index 8db461dc..945b7793 100644 --- a/clients/typescript/client-iam/README.md +++ b/clients/typescript/client-iam/README.md @@ -34,7 +34,7 @@ import { AuthProvider } from '@affinidi/test-auth-provider'; const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/clients/typescript/client-kms/README.md b/clients/typescript/client-kms/README.md index 655064e7..4c2bf8ad 100644 --- a/clients/typescript/client-kms/README.md +++ b/clients/typescript/client-kms/README.md @@ -34,7 +34,7 @@ import { AuthProvider } from '@affinidi/test-auth-provider'; const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/clients/typescript/client-kyc/README.md b/clients/typescript/client-kyc/README.md index c7972344..04df069f 100644 --- a/clients/typescript/client-kyc/README.md +++ b/clients/typescript/client-kyc/README.md @@ -34,7 +34,7 @@ import { AuthProvider } from '@affinidi/test-auth-provider'; const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/clients/typescript/client-ver/README.md b/clients/typescript/client-ver/README.md index 78c94934..b61361b3 100644 --- a/clients/typescript/client-ver/README.md +++ b/clients/typescript/client-ver/README.md @@ -34,7 +34,7 @@ import { AuthProvider } from '@affinidi/test-auth-provider'; const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/clients/typescript/client-vpa/README.md b/clients/typescript/client-vpa/README.md index 82e41fa4..e83bedab 100644 --- a/clients/typescript/client-vpa/README.md +++ b/clients/typescript/client-vpa/README.md @@ -34,7 +34,7 @@ import { AuthProvider } from '@affinidi/test-auth-provider'; const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/docs/examples/python/auth_provider.py b/docs/examples/python/auth_provider.py index 03ac8f74..ed933ec9 100644 --- a/docs/examples/python/auth_provider.py +++ b/docs/examples/python/auth_provider.py @@ -8,7 +8,7 @@ 'publicKey': '', 'passphrase': 'top-secret', 'keyId': 'KeyId', - 'machineUserId': '', + 'tokenId': '', 'projectId': '', 'tokenEndpoint': 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token', 'apiGatewayUrl': 'https://apse1.api.affinidi.io' diff --git a/docs/examples/python/client-cwe.py b/docs/examples/python/client-cwe.py index 90b69145..4bb8fb89 100644 --- a/docs/examples/python/client-cwe.py +++ b/docs/examples/python/client-cwe.py @@ -11,7 +11,7 @@ 'publicKey': '', 'passphrase': 'top-secret', 'keyId': 'KeyId', - 'machineUserId': '', + 'tokenId': '', 'projectId': '', 'tokenEndpoint': 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token', 'apiGatewayUrl': 'https://apse1.api.affinidi.io' diff --git a/docs/examples/typescript/auth_provider.ts b/docs/examples/typescript/auth_provider.ts index f0c2fb9e..67aa25b6 100644 --- a/docs/examples/typescript/auth_provider.ts +++ b/docs/examples/typescript/auth_provider.ts @@ -5,7 +5,7 @@ const authProvider = new AuthProvider({ publicKey: '', passphrase: 'top-secret', keyId: 'KeyId', - machineUserId: '', + tokenId: '', projectId: '', tokenEndpoint: 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token', diff --git a/docs/examples/typescript/client-cwe.ts b/docs/examples/typescript/client-cwe.ts index ac79441a..3fd64759 100644 --- a/docs/examples/typescript/client-cwe.ts +++ b/docs/examples/typescript/client-cwe.ts @@ -9,7 +9,7 @@ const privateKey = '' const publicKey = '' const passphrase = 'top-secret' const keyId = 'KeyId' -const machineUserId = '' +const tokenId = '' const projectId = '' const tokenEndpoint = 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token' @@ -18,7 +18,7 @@ const apiGatewayUrl = 'https://apse1.api.affinidi.io' const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/docs/examples/typescript/client-iam.ts b/docs/examples/typescript/client-iam.ts index f5de2e33..05d2a05b 100644 --- a/docs/examples/typescript/client-iam.ts +++ b/docs/examples/typescript/client-iam.ts @@ -9,7 +9,7 @@ const privateKey = '' const publicKey = '' const passphrase = 'top-secret' const keyId = 'KeyId' -const machineUserId = '' +const tokenId = '' const projectId = '' const tokenEndpoint = 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token' const apiGatewayUrl = 'https://apse1.api.affinidi.io' @@ -19,7 +19,7 @@ const projectScopedToken = '' const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, @@ -35,7 +35,7 @@ const iamConfiguration = new IamConfiguration({ async function getPolicies() { const api = new PoliciesApi(iamConfiguration) - const { data } = await api.getPolicies(machineUserId, 'token') + const { data } = await api.getPolicies(tokenId, 'token') return data } diff --git a/docs/examples/typescript/client-vpa.ts b/docs/examples/typescript/client-vpa.ts index 3ab1238f..8c7b2df8 100644 --- a/docs/examples/typescript/client-vpa.ts +++ b/docs/examples/typescript/client-vpa.ts @@ -11,7 +11,7 @@ const privateKey = '' const publicKey = '' const passphrase = 'top-secret' const keyId = 'KeyId' -const machineUserId = '' +const tokenId = '' const projectId = '' const tokenEndpoint = 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token' const apiGatewayUrl = 'https://apse1.api.affinidi.io' @@ -21,7 +21,7 @@ const projectScopedToken = '' const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/packages/auth-provider/README.md b/packages/auth-provider/README.md index 99e4068d..7703428a 100644 --- a/packages/auth-provider/README.md +++ b/packages/auth-provider/README.md @@ -24,7 +24,7 @@ import { AuthProvider } from '@affinidi/tdk-auth-provider' const authProvider = new AuthProvider({ apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, @@ -47,7 +47,7 @@ import affinidi_tdk.auth_provider stats = { apiGatewayUrl, keyId, - machineUserId, + tokenId, passphrase, privateKey, publicKey, diff --git a/packages/auth-provider/auth-provider.ts b/packages/auth-provider/auth-provider.ts index 2053bc58..4395e8aa 100644 --- a/packages/auth-provider/auth-provider.ts +++ b/packages/auth-provider/auth-provider.ts @@ -3,7 +3,7 @@ import { Jwt, ProjectScopedToken } from './helpers' export interface IAuthProviderParams { apiGatewayUrl: string keyId: string - machineUserId: string + tokenId: string passphrase: string privateKey: string projectId: string @@ -15,7 +15,7 @@ export class AuthProvider { private projectScopedToken = '' private readonly apiGatewayUrl: string = '' private readonly keyId: string = '' - private readonly machineUserId: string = '' + private readonly tokenId: string = '' private readonly passphrase: string = '' private readonly privateKey: string = '' private readonly projectId: string = '' @@ -28,7 +28,7 @@ export class AuthProvider { const authProviderParams: IAuthProviderParams = { apiGatewayUrl: '', keyId: '', - machineUserId: '', + tokenId: '', passphrase: '', privateKey: '', projectId: '', @@ -38,7 +38,7 @@ export class AuthProvider { this.validateMissingInput(authProviderParams, param) this.apiGatewayUrl = param.apiGatewayUrl this.keyId = param.keyId - this.machineUserId = param.machineUserId + this.tokenId = param.tokenId this.passphrase = param.passphrase this.privateKey = param.privateKey this.projectId = param.projectId @@ -73,7 +73,7 @@ export class AuthProvider { await this.projectScopedTokenInstance.fetchProjectScopedToken({ apiGatewayUrl: this.apiGatewayUrl, keyId: this.keyId, - machineUserId: this.machineUserId, + tokenId: this.tokenId, passphrase: this.passphrase, privateKey: this.privateKey, projectId: this.projectId, diff --git a/packages/auth-provider/helpers/fetch-project-scoped-token.ts b/packages/auth-provider/helpers/fetch-project-scoped-token.ts index c1da931f..e3f22633 100644 --- a/packages/auth-provider/helpers/fetch-project-scoped-token.ts +++ b/packages/auth-provider/helpers/fetch-project-scoped-token.ts @@ -6,7 +6,7 @@ import * as qs from 'qs' const ALGORITHM = 'RS256' export interface ISignPayload { - machineUserId: string + tokenId: string tokenEndpoint: string privateKey: string passphrase: string @@ -20,7 +20,7 @@ export interface IFetchProjectScopedToken extends ISignPayload { export class ProjectScopedToken { public async signPayload({ - machineUserId, + tokenId, tokenEndpoint, privateKey, passphrase, @@ -29,8 +29,8 @@ export class ProjectScopedToken { const issueTimeInSeconds = Math.floor(new Date().getTime() / 1000) const payload = { - iss: machineUserId, - sub: machineUserId, + iss: tokenId, + sub: tokenId, aud: tokenEndpoint, jti: new Date().toString() + Math.random(), exp: issueTimeInSeconds + 5 * 60, @@ -53,14 +53,14 @@ export class ProjectScopedToken { } public async getUserAccessToken({ - machineUserId, + tokenId, tokenEndpoint, privateKey, passphrase, keyId, }: ISignPayload) { const token = await this.signPayload({ - machineUserId, + tokenId, tokenEndpoint, privateKey, passphrase, @@ -73,7 +73,7 @@ export class ProjectScopedToken { client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', client_assertion: token, - client_id: machineUserId, + client_id: tokenId, }) const { data } = await axios(tokenEndpoint, { @@ -90,14 +90,14 @@ export class ProjectScopedToken { public async fetchProjectScopedToken({ apiGatewayUrl, projectId, - machineUserId, + tokenId, tokenEndpoint, privateKey, passphrase, keyId, }: IFetchProjectScopedToken) { const userAccessToken = await this.getUserAccessToken({ - machineUserId, + tokenId, tokenEndpoint, privateKey, passphrase,