Skip to content
Open
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
175 changes: 174 additions & 1 deletion src/FusionAuthClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,26 @@ export class FusionAuthClient {
.go();
}

/**
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
*
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
*
* @param {string} changePasswordId The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
* @returns {Promise<ClientResponse<void>>}
*/
checkChangePasswordUsingIdAndIPAddress(changePasswordId: string, ipAddress: string): Promise<ClientResponse<void>> {
return this.startAnonymous<void, Errors>()
.withUri('/api/user/change-password')
.withUriSegment(changePasswordId)
.withParameter('ipAddress', ipAddress)
.withMethod("GET")
.go();
}

/**
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
Expand All @@ -250,6 +270,26 @@ export class FusionAuthClient {
.go();
}

/**
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
*
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
*
* @param {string} encodedJWT The encoded JWT (access token).
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
* @returns {Promise<ClientResponse<void>>}
*/
checkChangePasswordUsingJWTAndIPAddress(encodedJWT: string, ipAddress: string): Promise<ClientResponse<void>> {
return this.startAnonymous<void, Errors>()
.withUri('/api/user/change-password')
.withAuthorization('Bearer ' + encodedJWT)
.withParameter('ipAddress', ipAddress)
.withMethod("GET")
.go();
}

/**
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
Expand All @@ -268,6 +308,26 @@ export class FusionAuthClient {
.go();
}

/**
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
*
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
*
* @param {string} loginId The loginId (email or username) of the User that you intend to change the password for.
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
* @returns {Promise<ClientResponse<void>>}
*/
checkChangePasswordUsingLoginIdAndIPAddress(loginId: string, ipAddress: string): Promise<ClientResponse<void>> {
return this.start<void, Errors>()
.withUri('/api/user/change-password')
.withParameter('loginId', loginId)
.withParameter('ipAddress', ipAddress)
.withMethod("GET")
.go();
}

/**
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
Expand All @@ -288,6 +348,28 @@ export class FusionAuthClient {
.go();
}

/**
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
*
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
*
* @param {string} loginId The loginId of the User that you intend to change the password for.
* @param {Array<String>} loginIdTypes The identity types that FusionAuth will compare the loginId to.
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
* @returns {Promise<ClientResponse<void>>}
*/
checkChangePasswordUsingLoginIdAndLoginIdTypesAndIPAddress(loginId: string, loginIdTypes: Array<String>, ipAddress: string): Promise<ClientResponse<void>> {
return this.start<void, Errors>()
.withUri('/api/user/change-password')
.withParameter('loginId', loginId)
.withParameter('loginIdTypes', loginIdTypes)
.withParameter('ipAddress', ipAddress)
.withMethod("GET")
.go();
}

/**
* Make a Client Credentials grant request to obtain an access token.
*
Expand Down Expand Up @@ -3853,6 +3935,24 @@ export class FusionAuthClient {
.go();
}

/**
* Retrieve a user's two-factor status.
*
* This can be used to see if a user will need to complete a two-factor challenge to complete a login,
* and optionally identify the state of the two-factor trust across various applications. This operation
* provides more payload options than retrieveTwoFactorStatus.
*
* @param {TwoFactorStatusRequest} request The request object that contains all the information used to check the status.
* @returns {Promise<ClientResponse<TwoFactorStatusResponse>>}
*/
retrieveTwoFactorStatusWithRequest(request: TwoFactorStatusRequest): Promise<ClientResponse<TwoFactorStatusResponse>> {
return this.start<TwoFactorStatusResponse, Errors>()
.withUri('/api/two-factor/status')
.withJSONBody(request)
.withMethod("POST")
.go();
}

/**
* Retrieves the user for the given Id.
*
Expand Down Expand Up @@ -5974,6 +6074,7 @@ export interface AuthenticationTokenConfiguration extends Enableable {
export interface LambdaConfiguration {
accessTokenPopulateId?: UUID;
idTokenPopulateId?: UUID;
multiFactorRequirementId?: UUID;
samlv2PopulateId?: UUID;
selfServiceRegistrationValidationId?: UUID;
userinfoPopulateId?: UUID;
Expand Down Expand Up @@ -6840,6 +6941,18 @@ export enum ContentStatus {
REJECTED = "REJECTED"
}

/**
* Represents the inbound lambda parameter 'context' for MFA Required lambdas.
*/
export interface Context {
authenticationThreats?: Array<AuthenticationThreats>;
encodedJWT?: string;
eventInfo?: EventInfo;
mfaTrust?: Trust;
policies?: Policies;
registration?: UserRegistration;
}

/**
* A number identifying a cryptographic algorithm. Values should be registered with the <a
* href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">IANA COSE Algorithms registry</a>
Expand Down Expand Up @@ -9065,7 +9178,8 @@ export enum LambdaType {
SCIMServerUserResponseConverter = "SCIMServerUserResponseConverter",
SelfServiceRegistrationValidation = "SelfServiceRegistrationValidation",
UserInfoPopulate = "UserInfoPopulate",
LoginValidation = "LoginValidation"
LoginValidation = "LoginValidation",
MFARequirement = "MFARequirement"
}

/**
Expand Down Expand Up @@ -9424,6 +9538,15 @@ export interface MonthlyActiveUserReportResponse {
total?: number;
}

/**
* Communicate various actions/contexts in which multi-factor authentication can be used.
*/
export enum MultiFactorAction {
changePassword = "changePassword",
login = "login",
stepUp = "stepUp"
}

/**
* @author Daniel DeGroff
*/
Expand Down Expand Up @@ -9869,6 +9992,15 @@ export interface PhoneUnverifiedOptions {
behavior?: UnverifiedBehavior;
}

/**
* Represents the inbound lambda parameter 'policies' for MFA Required lambdas.
*/
export interface Policies {
applicationLoginPolicy?: MultiFactorLoginPolicy;
applicationMultiFactorTrustPolicy?: ApplicationMultiFactorTrustPolicy;
tenantLoginPolicy?: MultiFactorLoginPolicy;
}

/**
* @author Michael Sleevi
*/
Expand Down Expand Up @@ -10099,6 +10231,7 @@ export interface ReactorStatus {
expiration?: string;
licenseAttributes?: Record<string, string>;
licensed?: boolean;
multiFactorLambdas?: ReactorFeatureStatus;
scimServer?: ReactorFeatureStatus;
tenantManagerApplication?: ReactorFeatureStatus;
threatDetection?: ReactorFeatureStatus;
Expand Down Expand Up @@ -10320,6 +10453,14 @@ export interface Requirable extends Enableable {
required?: boolean;
}

/**
* Represents the inbound lambda parameter 'result' for MFA Required lambdas.
*/
export interface RequiredLambdaResult {
required?: boolean;
sendSuspiciousLoginEvent?: boolean;
}

/**
* Interface describing the need for CORS configuration.
*
Expand Down Expand Up @@ -10872,6 +11013,7 @@ export interface TenantFormConfiguration {
*/
export interface TenantLambdaConfiguration {
loginValidationId?: UUID;
multiFactorRequirementId?: UUID;
scimEnterpriseUserRequestConverterId?: UUID;
scimEnterpriseUserResponseConverterId?: UUID;
scimGroupRequestConverterId?: UUID;
Expand Down Expand Up @@ -11273,6 +11415,26 @@ export enum TransactionType {
AbsoluteMajority = "AbsoluteMajority"
}

/**
* Represents the inbound lambda parameter 'mfaTrust' inside the 'context' parameter for MFA Required lambdas.
*/
export interface Trust {
applicationId?: UUID;
attributes?: Record<string, string>;
expirationInstant?: number;
id?: string;
insertInstant?: number;
startInstants?: StartInstant;
state?: Record<string, any>;
tenantId?: UUID;
userId?: UUID;
}

export interface StartInstant {
applications?: Record<UUID, number>;
tenant?: number;
}

/**
* @author Brett Guy
*/
Expand Down Expand Up @@ -11432,6 +11594,17 @@ export interface TwoFactorStartResponse {
twoFactorId?: string;
}

/**
* Check the status of two-factor authentication for a user, with more options than on a GET request.
*/
export interface TwoFactorStatusRequest extends BaseEventRequest {
action?: MultiFactorAction;
applicationId?: UUID;
token?: string;
twoFactorTrustId?: string;
userId?: UUID;
}

/**
* @author Daniel DeGroff
*/
Expand Down