Skip to content

Commit f5eb0e5

Browse files
wied03robotdanspwittbhalsey
authored
Merge degroff/ENG-1/issue1 (#155)
* Client library updates from enums * latest client updates * Updated version for go-client to 1.55.0 * Domain / Client Builder sync * Domain sync * domain sync * Updated version for go-client to 1.56.0 * domain sync * Merge wied03/ENG-1/tenant-mode-internal-user-removal (#94) * Updated go client * api version removal * update without InternalUser * update without InternalUser part 2 * add top-level user.phoneNumber field ENG-2208 * merge develop into issue1 * updates from app (#97) * updates after cleanup (#98) * sync clients with latest degroff/ENG-1/issue1 * add LoginIdType of phoneNumber (#99) * Merge wied03/ENG-2307/user-api-response-verification (#100) * client builder/API updates * Update * generate for identity verification external id configuration * generate clients ENG-1918 * external Id updates * add phone verification complete template and unverified behavior * Merge wied03/ENG-1963/phone_gating (#106) * client updates and ignore internal TODOs and comments * Separate verify start and complete * update after verify request changes * one more phone rename * regenerate after merge * regen client libraries (#108) ENG-2442 * phone clickable updates (#109) * add new login API response field (#110) * add application.registrationConfiguration.requirePassword boolean (#115) * client regen * new API field (#117) * remove application requirePassword, add tenant passwordEnabled (#118) * updates (#119) * Merge wied03/dev_merge (#121) * client built with sorted domain types (#120) * reapply issue 1 changes --------- Co-authored-by: Brent Halsey <[email protected]> * ENG-2608 - New APIs/method overloads (#124) * capture current cli state * test on all PRs * go generic String->string issue * Test this code path * add report method * make go format fail explicitly (was hiding an error) * now that this overload does not have opt params, remove defaults * Merge spencer/eng-1807/change-password-phone (#123) * forgot password via sms * regen clients * Merge wied03/ENG-2546/phone_passwordless_formfield (#126) * field rename * remove unneeded field * rename to PasswordlessLoginOneTimeCode * Merge wied03/ENG-2002/sms-send-set-pass (#127) * new API field * fail builds if compiles fail * add tenant phone verification and template configs (#128) * add state to verify complete response and start request (#130) * client builder sb build * Merge spencer/eng-2577/admin-phone-verif (#132) add /api/user/verify and request to clients * Merge wied03/ENG-1677/rate_limiting (#133) * rate limiting config change for pwless send phone * client update * wrong branch, another client update * updated stuff from issue 1 branch * remove VerifySendRequest.oneTimeCode. it is not used on that endpoint (#135) * add Application.phoneConfiguration for phone template overrides (#137) * sb build updates (#138) * add UserIdentityUpdateEvent (#139) * identity verified to user identity verified (#143) * remove passwordEnabled field (#142) * sb build follow up * Merge wied03/ENG-3045/import_verified (#151) * verifiedReason updates * ripple through comment updates * use enums on api requests (#154) * use PasswordlessStrategy enum for API request * use VerificationStrategy enum for API request * GHA ifs need to include success, or a previous step failure will not stop the run * match latest developer scripts * go mod tidy * roles property does not exist at the RegistrationRequest body level. It goes inside the registration --------- Co-authored-by: Daniel DeGroff <[email protected]> Co-authored-by: Spencer Witt <[email protected]> Co-authored-by: Brent Halsey <[email protected]> Co-authored-by: Spencer Witt <[email protected]> Co-authored-by: Brent Halsey <[email protected]>
1 parent 32bf3b2 commit f5eb0e5

File tree

7 files changed

+551
-87
lines changed

7 files changed

+551
-87
lines changed

.github/kickstart/kickstart.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
"admin"
7171
]
7272
},
73-
"roles": [
74-
"admin"
75-
],
7673
"skipRegistrationVerification": true,
7774
"user": {
7875
"birthDate": "1981-06-04",

.github/workflows/deploy.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ on:
66
branches:
77
- main
88
pull_request:
9-
branches:
10-
- main
119
workflow_dispatch:
1210
inputs:
1311
command:
@@ -56,28 +54,28 @@ jobs:
5654
go-version: oldstable
5755

5856
- name: Compile
59-
if: inputs.command != 'release'
57+
if: success() && inputs.command != 'release'
6058
run: sb compile
6159

6260
- name: Copy our kickstart file over so it gets picked up
63-
if: inputs.command != 'release'
61+
if: success() && inputs.command != 'release'
6462
run: |
6563
mkdir faDockerComposeFilePath
6664
cp -r .github/kickstart faDockerComposeFilePath
6765
cp .github/kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json
6866
cp .github/kickstart/kickstart.json .github/kickstart/k2.json
6967
7068
- name: Start FusionAuth
71-
if: inputs.command != 'release'
69+
if: success() && inputs.command != 'release'
7270
uses: fusionauth/fusionauth-github-action@v1
7371
with:
7472
FUSIONAUTH_APP_KICKSTART_FILENAME: k2.json
7573
FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: .github/kickstart
7674

7775
- name: Run tests
78-
if: inputs.command != 'release'
76+
if: success() && inputs.command != 'release'
7977
run: sleep 30 && sb test
8078

8179
- name: release to svn
82-
if: inputs.command == 'release'
80+
if: success() && inputs.command == 'release'
8381
run: sb release

build.savant

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2024, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2025, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ target(name: "format", description: "Formats the source code") {
5050

5151
def process = pb.start()
5252
process.consumeProcessOutput(System.out, System.err)
53-
process.waitFor()
53+
assert process.waitFor() == 0
5454
}
5555

5656
target(name: "compile", description: "Compiles the source code", dependsOn: ["format"]) {
@@ -60,7 +60,7 @@ target(name: "compile", description: "Compiles the source code", dependsOn: ["fo
6060

6161
def process = pb.start()
6262
process.consumeProcessOutput(System.out, System.err)
63-
process.waitFor()
63+
assert process.waitFor() == 0
6464
}
6565

6666
target(name: "test", description: "Runs the project's unit tests", dependsOn: ["compile"]) {
@@ -70,7 +70,7 @@ target(name: "test", description: "Runs the project's unit tests", dependsOn: ["
7070

7171
def process = pb.start()
7272
process.consumeProcessOutput(System.out, System.err)
73-
process.waitFor()
73+
assert process.waitFor() == 0
7474
}
7575

7676
target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["compile"]) {

pkg/fusionauth/Client.go

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,33 @@ func (c *FusionAuthClient) CommentOnUserWithContext(ctx context.Context, request
654654
return &resp, &errors, err
655655
}
656656

657+
// CompleteVerifyIdentity
658+
// Completes verification of an identity using verification codes from the Verify Start API.
659+
//
660+
// VerifyCompleteRequest request The identity verify complete request that contains all the information used to verify the identity.
661+
func (c *FusionAuthClient) CompleteVerifyIdentity(request VerifyCompleteRequest) (*VerifyCompleteResponse, *Errors, error) {
662+
return c.CompleteVerifyIdentityWithContext(context.TODO(), request)
663+
}
664+
665+
// CompleteVerifyIdentityWithContext
666+
// Completes verification of an identity using verification codes from the Verify Start API.
667+
//
668+
// VerifyCompleteRequest request The identity verify complete request that contains all the information used to verify the identity.
669+
func (c *FusionAuthClient) CompleteVerifyIdentityWithContext(ctx context.Context, request VerifyCompleteRequest) (*VerifyCompleteResponse, *Errors, error) {
670+
var resp VerifyCompleteResponse
671+
var errors Errors
672+
673+
restClient := c.Start(&resp, &errors)
674+
err := restClient.WithUri("/api/identity/verify/complete").
675+
WithJSONBody(request).
676+
WithMethod(http.MethodPost).
677+
Do(ctx)
678+
if restClient.ErrorRef == nil {
679+
return &resp, nil, err
680+
}
681+
return &resp, &errors, err
682+
}
683+
657684
// CompleteWebAuthnAssertion
658685
// Complete a WebAuthn authentication ceremony by validating the signature against the previously generated challenge without logging the user in
659686
//
@@ -7057,6 +7084,36 @@ func (c *FusionAuthClient) RetrieveUserByLoginIdWithContext(ctx context.Context,
70577084
return &resp, &errors, err
70587085
}
70597086

7087+
// RetrieveUserByLoginIdWithLoginIdTypes
7088+
// Retrieves the user for the loginId, using specific loginIdTypes.
7089+
//
7090+
// string loginId The email or username of the user.
7091+
// []string loginIdTypes the identity types that FusionAuth will compare the loginId to.
7092+
func (c *FusionAuthClient) RetrieveUserByLoginIdWithLoginIdTypes(loginId string, loginIdTypes []string) (*UserResponse, *Errors, error) {
7093+
return c.RetrieveUserByLoginIdWithLoginIdTypesWithContext(context.TODO(), loginId, loginIdTypes)
7094+
}
7095+
7096+
// RetrieveUserByLoginIdWithLoginIdTypesWithContext
7097+
// Retrieves the user for the loginId, using specific loginIdTypes.
7098+
//
7099+
// string loginId The email or username of the user.
7100+
// []string loginIdTypes the identity types that FusionAuth will compare the loginId to.
7101+
func (c *FusionAuthClient) RetrieveUserByLoginIdWithLoginIdTypesWithContext(ctx context.Context, loginId string, loginIdTypes []string) (*UserResponse, *Errors, error) {
7102+
var resp UserResponse
7103+
var errors Errors
7104+
7105+
restClient := c.Start(&resp, &errors)
7106+
err := restClient.WithUri("/api/user").
7107+
WithParameter("loginId", loginId).
7108+
WithParameter("loginIdTypes", loginIdTypes).
7109+
WithMethod(http.MethodGet).
7110+
Do(ctx)
7111+
if restClient.ErrorRef == nil {
7112+
return &resp, nil, err
7113+
}
7114+
return &resp, &errors, err
7115+
}
7116+
70607117
// RetrieveUserByUsername
70617118
// Retrieves the user for the given username.
70627119
//
@@ -7393,6 +7450,47 @@ func (c *FusionAuthClient) RetrieveUserLoginReportByLoginIdWithContext(ctx conte
73937450
return &resp, &errors, err
73947451
}
73957452

7453+
// RetrieveUserLoginReportByLoginIdAndLoginIdTypes
7454+
// Retrieves the login report between the two instants for a particular user by login Id, using specific loginIdTypes. If you specify an application id, it will only return the
7455+
// login counts for that application.
7456+
//
7457+
// string applicationId (Optional) The application id.
7458+
// string loginId The userId id.
7459+
// int64 start The start instant as UTC milliseconds since Epoch.
7460+
// int64 end The end instant as UTC milliseconds since Epoch.
7461+
// []string loginIdTypes the identity types that FusionAuth will compare the loginId to.
7462+
func (c *FusionAuthClient) RetrieveUserLoginReportByLoginIdAndLoginIdTypes(applicationId string, loginId string, start int64, end int64, loginIdTypes []string) (*LoginReportResponse, *Errors, error) {
7463+
return c.RetrieveUserLoginReportByLoginIdAndLoginIdTypesWithContext(context.TODO(), applicationId, loginId, start, end, loginIdTypes)
7464+
}
7465+
7466+
// RetrieveUserLoginReportByLoginIdAndLoginIdTypesWithContext
7467+
// Retrieves the login report between the two instants for a particular user by login Id, using specific loginIdTypes. If you specify an application id, it will only return the
7468+
// login counts for that application.
7469+
//
7470+
// string applicationId (Optional) The application id.
7471+
// string loginId The userId id.
7472+
// int64 start The start instant as UTC milliseconds since Epoch.
7473+
// int64 end The end instant as UTC milliseconds since Epoch.
7474+
// []string loginIdTypes the identity types that FusionAuth will compare the loginId to.
7475+
func (c *FusionAuthClient) RetrieveUserLoginReportByLoginIdAndLoginIdTypesWithContext(ctx context.Context, applicationId string, loginId string, start int64, end int64, loginIdTypes []string) (*LoginReportResponse, *Errors, error) {
7476+
var resp LoginReportResponse
7477+
var errors Errors
7478+
7479+
restClient := c.Start(&resp, &errors)
7480+
err := restClient.WithUri("/api/report/login").
7481+
WithParameter("applicationId", applicationId).
7482+
WithParameter("loginId", loginId).
7483+
WithParameter("start", strconv.FormatInt(start, 10)).
7484+
WithParameter("end", strconv.FormatInt(end, 10)).
7485+
WithParameter("loginIdTypes", loginIdTypes).
7486+
WithMethod(http.MethodGet).
7487+
Do(ctx)
7488+
if restClient.ErrorRef == nil {
7489+
return &resp, nil, err
7490+
}
7491+
return &resp, &errors, err
7492+
}
7493+
73967494
// RetrieveUserRecentLogins
73977495
// Retrieves the last number of login records for a user.
73987496
//
@@ -8785,6 +8883,33 @@ func (c *FusionAuthClient) SendTwoFactorCodeForLoginUsingMethodWithContext(ctx c
87858883
return &resp, &errors, err
87868884
}
87878885

8886+
// SendVerifyIdentity
8887+
// Send a verification code using the appropriate transport for the identity type being verified.
8888+
//
8889+
// VerifySendRequest request The identity verify send request that contains all the information used send the code.
8890+
func (c *FusionAuthClient) SendVerifyIdentity(request VerifySendRequest) (*BaseHTTPResponse, *Errors, error) {
8891+
return c.SendVerifyIdentityWithContext(context.TODO(), request)
8892+
}
8893+
8894+
// SendVerifyIdentityWithContext
8895+
// Send a verification code using the appropriate transport for the identity type being verified.
8896+
//
8897+
// VerifySendRequest request The identity verify send request that contains all the information used send the code.
8898+
func (c *FusionAuthClient) SendVerifyIdentityWithContext(ctx context.Context, request VerifySendRequest) (*BaseHTTPResponse, *Errors, error) {
8899+
var resp BaseHTTPResponse
8900+
var errors Errors
8901+
8902+
restClient := c.Start(&resp, &errors)
8903+
err := restClient.WithUri("/api/identity/verify/send").
8904+
WithJSONBody(request).
8905+
WithMethod(http.MethodPost).
8906+
Do(ctx)
8907+
if restClient.ErrorRef == nil {
8908+
return &resp, nil, err
8909+
}
8910+
return &resp, &errors, err
8911+
}
8912+
87888913
// StartIdentityProviderLogin
87898914
// Begins a login request for a 3rd party login that requires user interaction such as HYPR.
87908915
//
@@ -8880,6 +9005,35 @@ func (c *FusionAuthClient) StartTwoFactorLoginWithContext(ctx context.Context, r
88809005
return &resp, &errors, err
88819006
}
88829007

9008+
// StartVerifyIdentity
9009+
// Start a verification of an identity by generating a code. This code can be sent to the User using the Verify Send API
9010+
// Verification Code API or using a mechanism outside of FusionAuth. The verification is completed by using the Verify Complete API with this code.
9011+
//
9012+
// VerifyStartRequest request The identity verify start request that contains all the information used to begin the request.
9013+
func (c *FusionAuthClient) StartVerifyIdentity(request VerifyStartRequest) (*VerifyStartResponse, *Errors, error) {
9014+
return c.StartVerifyIdentityWithContext(context.TODO(), request)
9015+
}
9016+
9017+
// StartVerifyIdentityWithContext
9018+
// Start a verification of an identity by generating a code. This code can be sent to the User using the Verify Send API
9019+
// Verification Code API or using a mechanism outside of FusionAuth. The verification is completed by using the Verify Complete API with this code.
9020+
//
9021+
// VerifyStartRequest request The identity verify start request that contains all the information used to begin the request.
9022+
func (c *FusionAuthClient) StartVerifyIdentityWithContext(ctx context.Context, request VerifyStartRequest) (*VerifyStartResponse, *Errors, error) {
9023+
var resp VerifyStartResponse
9024+
var errors Errors
9025+
9026+
restClient := c.Start(&resp, &errors)
9027+
err := restClient.WithUri("/api/identity/verify/start").
9028+
WithJSONBody(request).
9029+
WithMethod(http.MethodPost).
9030+
Do(ctx)
9031+
if restClient.ErrorRef == nil {
9032+
return &resp, nil, err
9033+
}
9034+
return &resp, &errors, err
9035+
}
9036+
88839037
// StartWebAuthnLogin
88849038
// Start a WebAuthn authentication ceremony by generating a new challenge for the user
88859039
//
@@ -10094,6 +10248,33 @@ func (c *FusionAuthClient) VerifyEmailAddressByUserIdWithContext(ctx context.Con
1009410248
return &resp, &errors, err
1009510249
}
1009610250

10251+
// VerifyIdentity
10252+
// Administratively verify a user identity.
10253+
//
10254+
// VerifyRequest request The identity verify request that contains information to verify the identity.
10255+
func (c *FusionAuthClient) VerifyIdentity(request VerifyRequest) (*BaseHTTPResponse, *Errors, error) {
10256+
return c.VerifyIdentityWithContext(context.TODO(), request)
10257+
}
10258+
10259+
// VerifyIdentityWithContext
10260+
// Administratively verify a user identity.
10261+
//
10262+
// VerifyRequest request The identity verify request that contains information to verify the identity.
10263+
func (c *FusionAuthClient) VerifyIdentityWithContext(ctx context.Context, request VerifyRequest) (*BaseHTTPResponse, *Errors, error) {
10264+
var resp BaseHTTPResponse
10265+
var errors Errors
10266+
10267+
restClient := c.Start(&resp, &errors)
10268+
err := restClient.WithUri("/api/identity/verify").
10269+
WithJSONBody(request).
10270+
WithMethod(http.MethodPost).
10271+
Do(ctx)
10272+
if restClient.ErrorRef == nil {
10273+
return &resp, nil, err
10274+
}
10275+
return &resp, &errors, err
10276+
}
10277+
1009710278
// VerifyRegistration
1009810279
// Confirms an application registration. The Id given is usually from an email sent to the user.
1009910280
//

pkg/fusionauth/Client_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,28 @@ func TestRetrieveUserSuccess(t *testing.T) {
6060
assert.Equal(t, 200, userResponse.StatusCode)
6161
}
6262

63+
func TestRetrieveUserByLoginIdSuccess(t *testing.T) {
64+
loginIdTypes := []string{"email"}
65+
66+
userResponse, errors, _ := faClient.RetrieveUserByLoginIdWithLoginIdTypes("[email protected]", loginIdTypes)
67+
errJson, _ := json.Marshal(errors)
68+
fmt.Println(string(errJson))
69+
70+
assert.Equal(t, (*Errors)(nil), errors)
71+
assert.Equal(t, 200, userResponse.StatusCode)
72+
}
73+
74+
// TODO: Will pass when issue 1 is released
75+
// func TestRetrieveUserByLoginIdWrongIdentityType(t *testing.T) {
76+
// loginIdTypes := []string{"phoneNumber"}
77+
//
78+
// userResponse, errors, _ := faClient.RetrieveUserByLoginIdWithLoginIdTypes("[email protected]", loginIdTypes)
79+
// errJson, _ := json.Marshal(errors)
80+
// fmt.Println(string(errJson))
81+
//
82+
// assert.Equal(t, 404, userResponse.StatusCode)
83+
// }
84+
6385
func TestMain(m *testing.M) {
6486
os.Exit(m.Run())
6587
}

0 commit comments

Comments
 (0)