Skip to content

Commit

Permalink
Merge 53c6a0b into 03ec238
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Feb 11, 2022
2 parents 03ec238 + 53c6a0b commit 3e31ff7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 9 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,11 @@ type ToznySDKV3 struct {
// Tozny server defined globally unique id for this Client.
ClientID string
CurrentIdentity TozIDSessionIdentityData
config e3dbClients.ClientConfig
akCache map[akCacheKey]e3dbClients.SymmetricKey
// AgentToken is the tozid-realm-idp jwt given by final redirect of login flow.
// because it expires, it is not saved to the config file, and so can be empty.
AgentToken *string
config e3dbClients.ClientConfig
akCache map[akCacheKey]e3dbClients.SymmetricKey
}

// LoggedInIdentityData represents data about the identity session of a given user. Currently that is just realm and
Expand All @@ -710,6 +713,7 @@ type ToznySDKConfig struct {
AccountUsername string `json:"account_username"`
AccountPassword string `json:"account_password"`
APIEndpoint string `json:"api_url"`
AgentToken *string
}

// NewToznySDK returns a new instance of the ToznySDK initialized with the provided
Expand All @@ -732,6 +736,7 @@ func NewToznySDKV3(config ToznySDKConfig) (*ToznySDKV3, error) {
APIEndpoint: config.APIEndpoint,
ClientID: config.ClientID,
CurrentIdentity: config.TozIDSessionIdentityData,
AgentToken: config.AgentToken,
config: config.ClientConfig,
}, nil
}
Expand Down Expand Up @@ -778,6 +783,7 @@ func sdkV3FromConfig(config ToznySDKJSONConfig) (*ToznySDKV3, error) {
AccountUsername: config.AccountUsername,
AccountPassword: config.AccountPassword,
APIEndpoint: config.APIBaseURL,
AgentToken: config.AgentToken,
TozIDSessionIdentityData: TozIDSessionIdentityData{
Username: config.Username,
Realm: config.Realm,
Expand Down Expand Up @@ -920,6 +926,7 @@ func GetSDKV3ForTozIDUser(login TozIDLoginRequest) (*ToznySDKV3, error) {
if err != nil {
return nil, err
}
config.AgentToken = &redirect.AccessToken
config.Realm = realmInfo.Name
config.Username = username
return sdkV3FromConfig(config)
Expand Down
9 changes: 5 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ type ToznySDKJSONConfig struct {
// Embed all config for v1 and v2 clients
ConfigFile
TozIDSessionIdentityData `json:"toz_id_session_identity_data"`
PublicSigningKey string `json:"public_signing_key"`
PrivateSigningKey string `json:"private_signing_key"`
AccountUsername string `json:"account_user_name"`
AccountPassword string `json:"account_password"`
PublicSigningKey string `json:"public_signing_key"`
PrivateSigningKey string `json:"private_signing_key"`
AccountUsername string `json:"account_user_name"`
AccountPassword string `json:"account_password"`
AgentToken *string // the tozid-realm-idp client jwt
}

// LoadConfigFile loads JSON configuration for a Tozny SDK from the file
Expand Down

0 comments on commit 3e31ff7

Please sign in to comment.