java-socks-proxy-server icon indicating copy to clipboard operation
java-socks-proxy-server copied to clipboard

Extend Authentication Modes

Open XomaDev opened this issue 9 months ago • 1 comments

I've been working on extending auth mode, to support dynamic username/password authentication, with some refactoring.

    new SocksServer(determinePort(args))
        .setAuthenticator(new UsernamePasswordAuthenticator(false) {
          @Override
          public boolean validate(String username, String password) {
            return username.equals("mysecureusername") && password.equals("mysecurepassword");
          }
        }).start();

So far it is working good, I've tried with multiple clients.

XomaDev avatar May 06 '24 05:05 XomaDev

This update modifies the constructors, to effectively pass configuration through constructors, rather than methods. So anyone after updating to this code, will have to do a small refactor.

XomaDev avatar May 06 '24 05:05 XomaDev

Hey, thanks you so much for helping out!

This update modifies the constructors, to effectively pass configuration through constructors, rather than methods. So anyone after updating to this code, will have to do a small refactor.

Is this still the case? If so, can't you provide a default constructor for backwards compatibility?

Also, in the README changes, you removed the line of stopping servers. You also removed the examples for use in junit testing (although I admit I forgot to update this myself, when I switched to JUnit 5). And also, previously it was demonstrated in the documentation that you can start multiple listeners on different ports. I feel this point got lost in your version.

bbottema avatar May 14 '24 07:05 bbottema

Is this still the case? If so, can't you provide a default constructor for backwards compatibility?

Hi yes, it is still the case, yes I can provide backwards compatibility, I'll update the code.

Also, in the README changes, you removed the line of stopping servers.

That's right, I'll add those lines.

You also removed the examples for use in junit testing (although I admit I forgot to update this myself, when I switched to JUnit 5).

I'm not exactly sure what I have to add, could you please help me out there?

And also, previously it was demonstrated in the documentation that you can start multiple listeners on different ports. I feel this point got lost in your version.

IMO, letting one single instance start multiple listeners on different port feels wrong. Each instance of SocksServer should only effectively manage one server, along with customization to each individual server.

XomaDev avatar May 14 '24 14:05 XomaDev

You also removed the examples for use in junit testing (although I admit I forgot to update this myself, when I switched to JUnit 5).

I'm not exactly sure what I have to add, could you please help me out there?

That's fine, I'll add the examples shortly.

And also, previously it was demonstrated in the documentation that you can start multiple listeners on different ports. I feel this point got lost in your version.

IMO, letting one single instance start multiple listeners on different port feels wrong. Each instance of SocksServer should only effectively manage one server, along with customization to each individual server.

Perhaps, but it is what it is; this is how the library works right now. I'll let the users decide how to use it, but I don't want to hide it by not documenting it.

bbottema avatar May 14 '24 14:05 bbottema

Perhaps, but it is what it is; this is how the library works right now. I'll let the users decide how to use it, but I don't want to hide it by not documenting it.

Hmm, so are we keeping this version, or revert back to the old system where each instance can spawn multiple servers?

XomaDev avatar May 14 '24 14:05 XomaDev

Perhaps, but it is what it is; this is how the library works right now. I'll let the users decide how to use it, but I don't want to hide it by not documenting it.

Hmm, so are we keeping this version, or revert back to the old system where each instance can spawn multiple servers?

Oh you changed it. I thought you only changed the documentation :D

bbottema avatar May 14 '24 14:05 bbottema

Alright, I had a quick look. I'm fine with the change.

bbottema avatar May 14 '24 14:05 bbottema

I'll edit the code for backwards compatibility, also resolve the conflict.

XomaDev avatar May 14 '24 14:05 XomaDev

@bbottema can you please review? Can you also update the change history and the version?

XomaDev avatar May 15 '24 07:05 XomaDev

Released in v4.1.0! Thanks again!

bbottema avatar May 15 '24 08:05 bbottema