Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit aaf8032

Browse files
committed
now you can switch username
1 parent 1ea4067 commit aaf8032

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

authorization.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,21 @@ func newAuthorization(dr *DigestRequest) (*authorization, error) {
4242
Response: "",
4343
Uri: "",
4444
Userhash: dr.Wa.Userhash,
45-
Username: dr.Username,
45+
Username: "",
4646
Username_: "", // TODO
4747
}
4848

49-
if ah.Userhash {
50-
ah.Username = ah.hash(fmt.Sprintf("%s:%s", ah.Username, ah.Realm))
51-
}
52-
5349
return ah.refreshAuthorization(dr)
5450
}
5551

5652
func (ah *authorization) refreshAuthorization(dr *DigestRequest) (*authorization, error) {
5753

54+
ah.Username = dr.Username
55+
56+
if ah.Userhash {
57+
ah.Username = ah.hash(fmt.Sprintf("%s:%s", ah.Username, ah.Realm))
58+
}
59+
5860
ah.Nc++
5961

6062
ah.Cnonce = ah.hash(fmt.Sprintf("%d:%s:my_value", time.Now().UnixNano(), dr.Username))

0 commit comments

Comments
 (0)