hermannpencole / nifi-swagger-client

Client swagger for nifi with security
Apache License 2.0
38 stars 20 forks source link

[Question] How do I authenticate? #22

Open alainbodiguel opened 1 year ago

alainbodiguel commented 1 year ago

Having my NIFI 1.20.0 running with HTTPS and single user authentication (username+password), I can't figure out how to authenticate the client. I tried the following:

            ApiClient client = Configuration.getDefaultApiClient()
                    .setBasePath(basePath)
                    .setVerifyingSsl(false)
                    .setDebugging(true);
            // following line logs nothing: authentications map is empty by default
            client.getAuthentications().forEach((k,v) -> System.out.println(k+"="+v));

            AccessApi apiInstance = new AccessApi();
            String token = apiInstance.createAccessToken(username, password);
            client.setAccessToken(token); // raises RuntimeException "No OAuth2 authentication configured!"
            client.setUsername("username"); // raises RuntimeException "No HTTP basic authentication configured!"

Any hint? Thanks in advance