How to create a GET request inside the dropwizard authentication method?

SapphireBlazer01 :
public class ExampleAuthenticator implements Authenticator<String, User> {
    @Override
    public Optional<User> authenticate(String credentials) throws AuthenticationException {

        return verifyToken(credentials);
    }

    public Optional<User> verifyToken(String credentials){
        //some code that verifies token

        //call a Get-request around here.
        return //user
    }
}

I want the user to receive some data from the server each time it passes the verification of a token. I searched all night for this, but never found someone talking about this. My question: Is this even possible and if so, how would I approach this.

Nandu Raj :

Usually, for this kind of scenario, we write an API(which will be GET request in your case) which will be called at regular interval time or after each API call to get the required data, whatever way we want it. We call it a polling API. You can also give authenticator access for that API.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=396807&siteId=1