-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Adds 3rd party login functionality to retrieve a V3SDK
- Supports arbitrary action handler functions - Example mfa function in identity_test - More tests to come
- Loading branch information
Eli Fabens
committed
Apr 14, 2021
1 parent
9c01156
commit 1f939cd
Showing
5 changed files
with
179 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package e3db | ||
|
||
import ( | ||
"fmt" | ||
"github.com/tozny/e3db-clients-go/identityClient" | ||
"testing" | ||
) | ||
|
||
func TestToznySDKV3_Login(t *testing.T) { | ||
request := TozIDLoginRequest{ | ||
Username: "", | ||
Password: "", | ||
RealmName: "", | ||
APIBaseURL: "https://api.e3db.com", | ||
LoginHandler: mfaHandler, | ||
} | ||
sdk, err := GetSDKV3ForTozIDUser(request) | ||
if err != nil { | ||
t.Fatal("Abort", err) | ||
} | ||
fmt.Printf("%v", sdk) | ||
} | ||
|
||
func mfaHandler(sessionResponse *identityClient.IdentitySessionRequestResponse) (LoginActionData, error) { | ||
if sessionResponse.LoginActionType == "login-totp" { | ||
totpValue := make(map[string]string) | ||
totpValue["otp"] = "" | ||
return totpValue, nil | ||
} | ||
return nil, fmt.Errorf("mfaHandler cannot support \"%s\" action types", sessionResponse.LoginActionType) | ||
} |