Git Product home page Git Product logo

Comments (3)

vietj avatar vietj commented on June 1, 2024

a reproducer would be helpfull

from vert.x.

bmohareb avatar bmohareb commented on June 1, 2024

`
// This will obtain the token from local cache and connect to KDC to obtain token for the proxy
public String getToken() throws GSSException {

    Oid spnegoOid = new Oid("1.3.6.1.5.5.2");
    GSSManager manager = GSSManager.getInstance();
    // This is the secure proxy server that we want to authenticate to using kerberos
    String serverPrinciple = "[email protected]";
    GSSName serverName = manager.createName(serverPrinciple, GSSName.NT_HOSTBASED_SERVICE);
    GSSContext clientContext = manager.createContext(
            serverName.canonicalize(spnegoOid), spnegoOid, null, GSSContext.DEFAULT_LIFETIME);
    clientContext.requestMutualAuth(true);
    byte[] clientToken = clientContext.initSecContext(new byte[0], 0, 0);
    return Base64.getEncoder().encodeToString(clientToken);
}


@Test
public void testSecureProxy3(Vertx vertx, VertxTestContext ctx) throws GSSException {

    System.setProperty("java.security.krb5.conf", "krb5.conf");
    System.setProperty("java.security.auth.login.config", "jaas.conf");
    System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
    System.setProperty("sun.security.krb5.debug", "true");
    System.setProperty("sun.security.jgss.debug", "true");

    WebClientOptions wco = new WebClientOptions()
            .setFollowRedirects(true)
            .setSsl(true);

    ProxyOptions po = new ProxyOptions()
            .setHost("myproxy.com")
            .setPort(1234);

    wco.setProxyOptions(po);

    WebClient wc = WebClient.create(vertx, wco);

    String token = getToken();

    wc
            .getAbs("https://website_to_reach_through_proxy.com")
            .putHeader("Proxy-Authorization", "Negotiate " + token)
            .send()
            .onFailure(error -> {    // This is always returning 407 error code
                System.out.println(error.getMessage());
                ctx.failNow(error);
            })
            .onSuccess(result -> {
                System.out.println(result);
                ctx.completeNow();
            });

}

`

from vert.x.

vietj avatar vietj commented on June 1, 2024

I'm afraid we don't support that in Vert.x, we support proxy authentication through Netty HttpProxyHandler that only supports basic authentication. There are chances that this can be achieved by contributing an enhancement in Netty proxy handler.

from vert.x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.