Skip to content

Commit

Permalink
CognitoIdp fixes (#4518)
Browse files Browse the repository at this point in the history
  • Loading branch information
mianowski committed Mar 10, 2022
1 parent 07913cf commit a4f58f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion moto/cognitoidp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ def initiate_auth(self, client_id, auth_flow, auth_parameters):
"ChallengeParameters": {
"SALT": uuid.uuid4().hex,
"SRP_B": uuid.uuid4().hex,
"USERNAME": user.id,
"USERNAME": user.username,
"USER_ID_FOR_SRP": user.id,
"SECRET_BLOCK": session,
},
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cognitoidp/test_cognitoidp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,7 @@ def user_authentication_flow(conn):

result["AuthenticationResult"]["IdToken"].should_not.be.none
result["AuthenticationResult"]["AccessToken"].should_not.be.none
result["AuthenticationResult"]["TokenType"].should.equal("Bearer")

# authenticate user once again this time with mfa token
result = conn.initiate_auth(
Expand Down Expand Up @@ -3317,6 +3318,7 @@ def test_initiate_auth_USER_SRP_AUTH():
)

result["ChallengeName"].should.equal("PASSWORD_VERIFIER")
result["ChallengeParameters"]["USERNAME"].should.equal(username)


@mock_cognitoidp
Expand Down Expand Up @@ -3385,6 +3387,7 @@ def test_initiate_auth_USER_PASSWORD_AUTH():
result["AuthenticationResult"]["AccessToken"].should_not.be.none
result["AuthenticationResult"]["IdToken"].should_not.be.none
result["AuthenticationResult"]["RefreshToken"].should_not.be.none
result["AuthenticationResult"]["TokenType"].should.equal("Bearer")


@mock_cognitoidp
Expand Down

0 comments on commit a4f58f0

Please sign in to comment.