-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Username and Password authentication #2
Implement Username and Password authentication #2
Conversation
02be171
to
59b3bf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repo is definitely not ready for contributions, since it is very early in development, but I do appreciate some help. So although I'm requesting changes, it's mostly due to me not updating the code properly, so without changes we will run into issues in the future.
The IProxyAuth
interface and many other components of this library were initially copied from this PR: https://github.com/Ryujinx/Ryujinx/pull/5989
The PR only implements the client side of the protocol and I haven't updated everything to support both sides yet.
You can also look into the unit tests there, since I would like to have unit tests for all the authentication methods (and the rest of this codebase).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As requested, a review of your latest changes. Thank you for working on this!
51efe88
to
952d428
Compare
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs
Outdated
Show resolved
Hide resolved
952d428
to
caafd11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few formatting issues and the client side implementation of Authenticate()
is missing.
The packets still need some work, but we are slowly getting there.
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs
Outdated
Show resolved
Hide resolved
caafd11
to
70175fa
Compare
8877738
to
67ee2a3
Compare
c60b5de
to
8110169
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased your PR branch, after I just pushed a lot of changes, I hope that's okay for you.
There are a few things I noticed:
- The response packet doesn't seem to have been adjusted to use
Bytes
directly. - Currently there is no client-side implementation for
UsernameAndPassword.Authenticate()
available. Could you add that?
Also could you move the packets to RyuSocks.Auth.Packets.UsernameAndPassword
?
The last thing that would be missing is an entry in CHANGELOG.md
. Could you add that as well?
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only need you to look at that changelog entry again, the rest is fine! Only other comments are some styling issues.
RyuSocks/Auth/UsernameAndPassword.cs
Outdated
public string Username; | ||
public string Password; | ||
public bool IsClient; | ||
public Dictionary<string, string> Database | ||
{ | ||
get; | ||
set; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm somewhat unhappy with this, but I need to think about it a bit longer.
I don't want you to change anything here, since it looks fine, but design-wise I might want to change how this works eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordResponse.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few formatting issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Just missing the tests now! I'll add some examples soon.
Hope these tests serve as good examples for now: https://github.com/TSRBerry/RyuSOCKS/tree/dev/RyuSocks.Test |
31a9791
to
015cbd8
Compare
bf28716
to
6db5394
Compare
fc7e3b3
to
c3900d9
Compare
Adds UaPPacket, containing all necessary variables for UaP Authentication Adds AuthenticationPacket containing version
Added IAuthenticationPacket.cs as parent class for authentication packages UsernameAndPassword.cs converts incomingPacket to UaPPacket.cs via FromArray
Removed IAuthenticationPacket.cs Renamed UaPPacket to UsernameAndPasswordRequest.cs and moved to ./Auth/UsernameAndPassword Use Encoding.ASCII.GetString() instead of ToString() Use byte instead of int for Username/Password Length
c3900d9
to
8618087
Compare
Implementing Username and Password authentication according to RFC1929