Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 125 additions & 1 deletion api/defaultApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3614,13 +3614,19 @@ export class DefaultApi {
*/
public async generateMfaToken(
authorization: string,
userId: number,
generateMfaTokenRequest: GenerateMfaTokenRequest,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{
response: http.IncomingMessage;
body: GenerateMfaToken200Response;
}> {
const localVarPath = this.basePath + "/api/2/mfa/users/{user_id}/mfa_token";
const localVarPath =
this.basePath +
"/api/1/users/{user_id}/mfa_token".replace(
"{" + "user_id" + "}",
encodeURIComponent(String(userId))
);
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign(
{},
Expand Down Expand Up @@ -16188,4 +16194,122 @@ export class DefaultApi {
});
});
}

public async verifyingFactor(
authorization: string,
userId: number,
verifyFactorRequest: VerifyFactorRequest,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{
response: http.IncomingMessage;
body: VerifyFactorVoice200ResponseInner;
}> {
const localVarPath =
this.basePath +
"/api/2/mfa/users/{user_id}/verifications/".replace(
"{" + "user_id" + "}",
encodeURIComponent(String(userId))
);
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign(
{},
this._defaultHeaders
);
const produces = ["application/json"];
// give precedence to 'application/json'
if (produces.indexOf("application/json") >= 0) {
localVarHeaderParams.Accept = "application/json";
} else {
localVarHeaderParams.Accept = produces.join(",");
}
let localVarFormParams: any = {};

// verify required parameter 'authorization' is not null or undefined
if (authorization === null || authorization === undefined) {
throw new Error(
"Required parameter authorization was null or undefined when calling verifyingFactor."
);
}

// verify required parameter 'userId' is not null or undefined
if (userId === null || userId === undefined) {
throw new Error(
"Required parameter userId was null or undefined when calling verifyingFactor."
);
}

// verify required parameter 'verifyFactorRequest' is not null or undefined
if (verifyFactorRequest === null || verifyFactorRequest === undefined) {
throw new Error(
"Required parameter verifyFactorRequest was null or undefined when calling verifyingFactor."
);
}

localVarHeaderParams["Authorization"] = ObjectSerializer.serialize(
authorization,
"string"
);
(<any>Object).assign(localVarHeaderParams, options.headers);

let localVarUseFormData = false;

let localVarRequestOptions: localVarRequest.Options = {
method: "POST",
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(
verifyFactorRequest,
"VerifyFactorRequest"
),
};

let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() =>
this.authentications.default.applyToRequest(localVarRequestOptions)
);

let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() =>
interceptor(localVarRequestOptions)
);
}

return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{
response: http.IncomingMessage;
body: VerifyFactorVoice200ResponseInner;
}>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (
response.statusCode &&
response.statusCode >= 200 &&
response.statusCode <= 299
) {
body = ObjectSerializer.deserialize(
body,
"VerifyFactorVoice200ResponseInner"
);
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
}
84 changes: 29 additions & 55 deletions model/generateMfaToken200Response.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,35 @@
/**
* OneLogin API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 3.0.0-alpha.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export class GenerateMfaToken200Response {
"mfaToken"?: string;

import { RequestFile } from './models';
"reusable"?: boolean;

export class GenerateMfaToken200Response {
/**
* Token can function as a temporary MFA token. It can be used to authenticate for any app when valid.
*/
'mfaToken'?: string;
/**
* true indcates the token can be used multiple times. false indicates the token is invalid after a single use
*/
'reusable'?: boolean;
/**
* Defines the expiration time and date for the token. Format is UTC time.
*/
'expiresAt'?: string;
/**
* Defines the expiration time and date for the token. Format is UTC time.
*/
'deviceId'?: string;
"expiresAt"?: string;

static discriminator: string | undefined = undefined;
static discriminator: string | undefined = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "mfaToken",
"baseName": "mfa_token",
"type": "string"
},
{
"name": "reusable",
"baseName": "reusable",
"type": "boolean"
},
{
"name": "expiresAt",
"baseName": "expires_at",
"type": "string"
},
{
"name": "deviceId",
"baseName": "device_id",
"type": "string"
} ];
static attributeTypeMap: Array<{
name: string;
baseName: string;
type: string;
}> = [
{
name: "mfaToken",
baseName: "mfa_token",
type: "string",
},
{
name: "reusable",
baseName: "reusable",
type: "boolean",
},
{
name: "expiresAt",
baseName: "expires_at",
type: "string",
},
];

static getAttributeTypeMap() {
return GenerateMfaToken200Response.attributeTypeMap;
}
static getAttributeTypeMap() {
return GenerateMfaToken200Response.attributeTypeMap;
}
}