in src/Amazon.Extensions.CognitoAuthentication/CognitoUser.cs [110:161]
public CognitoUser(string userID, string clientID,
CognitoUserPool pool,
IAmazonCognitoIdentityProvider provider,
string clientSecret = null,
string status = null,
string username = null,
Dictionary<string, string> attributes = null)
{
if(pool.PoolID.Contains("_"))
{
this.PoolName = pool.PoolID.Split('_')[1];
}
else
{
throw new ArgumentException("Pool's poolID malformed, should be of the form <region>_<poolname>.");
}
this.ClientSecret = clientSecret;
this.UserID = userID;
if (!string.IsNullOrEmpty(username))
{
this.Username = username;
}
else
{
this.Username = userID;
}
if (!string.IsNullOrEmpty(clientSecret))
{
this.SecretHash = CognitoAuthHelper.GetUserPoolSecretHash(Username, clientID, clientSecret);
}
this.Status = status;
this.UserPool = pool;
this.ClientID = clientID;
this.SessionTokens = null;
if (attributes != null)
{
this.Attributes = attributes;
}
this.Provider = provider;
if (this.Provider is AmazonCognitoIdentityProviderClient eventProvider)
{
eventProvider.BeforeRequestEvent += CognitoAuthHelper.ServiceClientBeforeRequestEvent;
}
}