aws / aws-sdk-net-extensions-cognito

An extension library to assist in the Amazon Cognito User Pools authentication process
Apache License 2.0
102 stars 49 forks source link

CognitoUser.SecretHash initialization fix #126

Closed DmitryProskurin closed 9 months ago

DmitryProskurin commented 12 months ago

Hello everyone! I want to change order of initialization of SecretHash property in CognitoUser ctor. If i pass valid username to CognitoUser ctor, it will be ignored because of order of assignment. My changes helps create SecretHash in ctor if valid username provided. It fixes issue, when i create CognitoUser with valid username and call StartWithRefreshTokenAuthAsync. It fails because UserId used instead of Username for SecretHash calculation.

Username changes only in two palces: CognitoUser ctor and UpdateUsernameAndSecretHash. ClientId and ClientSecret properties has private setters and can't be changed outside of class. So, i replace SecretHash recalculation to it direct usage.

Also, i replace raw string to usage of CognitoConstants & ChallengeNameType class properties.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

DmitryProskurin commented 12 months ago

@peterrsongg

DmitryProskurin commented 11 months ago

@philasmar, @dscpinheiro, when i should expect code review?

96malhar commented 9 months ago

Thank you for this PR! It has been released in version 2.5.2