Skip to content

Commit

Permalink
Add type alias for Login handlers to reduce downstream imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli Fabens committed Apr 28, 2021
1 parent 6f4d8e1 commit 1b35697
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,15 +736,18 @@ func sdkV3FromConfig(config ToznySDKJSONConfig) (*ToznySDKV3, error) {

type LoginActionData = map[string]string

type IdentitySessionIntermediateResponse = identityClient.IdentitySessionRequestResponse

type TozIDLoginRequest struct {
Username string
Password string
RealmName string

APIBaseURL string
LoginHandler func(response *identityClient.IdentitySessionRequestResponse) (LoginActionData, error)
LoginHandler func(response *IdentitySessionIntermediateResponse) (LoginActionData, error)
}


//GetSDKV3ForTozIDUser logs in a TozID user and returns the storage client of that user as a ToznySDKV3
func GetSDKV3ForTozIDUser(login TozIDLoginRequest) (*ToznySDKV3, error) {
if login.APIBaseURL == "" {
Expand Down
3 changes: 1 addition & 2 deletions identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package e3db

import (
"fmt"
"github.com/tozny/e3db-clients-go/identityClient"
"testing"
)

Expand All @@ -21,7 +20,7 @@ func TestToznySDKV3_Login(t *testing.T) {
fmt.Printf("%v", sdk)
}

func mfaHandler(sessionResponse *identityClient.IdentitySessionRequestResponse) (LoginActionData, error) {
func mfaHandler(sessionResponse *IdentitySessionIntermediateResponse) (LoginActionData, error) {
if sessionResponse.LoginActionType == "login-totp" {
totpValue := make(map[string]string)
totpValue["otp"] = ""
Expand Down

0 comments on commit 1b35697

Please sign in to comment.