quarkus:如何通过rest客户端提供令牌

quarkus:如何通过rest客户端提供令牌,rest,security,testing,token,quarkus,Rest,Security,Testing,Token,Quarkus,在单元测试中,我通过REST客户端(通过@RegisterRestClient注释接口)调用@Authenticated端点。如何在REST调用中提供令牌 接口 : import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; @RegisterRestClient public interface My

在单元测试中,我通过REST客户端(通过@RegisterRestClient注释接口)调用@Authenticated端点。如何在REST调用中提供令牌

接口 :

import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

@RegisterRestClient
public interface MyAuthenticatedService {

    @GET
    public void myAuthenticatedCall(@HeaderParam("Authorization") String token);

}
电话本身呢 :

import javax.inject.Inject;
import org.eclipse.microprofile.rest.client.inject.RestClient;

public class FoobarService {

    @Inject
    @RestClient
    MyAuthenticatedService myService;

    public void foobar(String token) {
        myService.myAuthenticatedCall("Bearer " + token); // beware of the space
    }
}
接口 :

import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

@RegisterRestClient
public interface MyAuthenticatedService {

    @GET
    public void myAuthenticatedCall(@HeaderParam("Authorization") String token);

}
电话本身呢 :

import javax.inject.Inject;
import org.eclipse.microprofile.rest.client.inject.RestClient;

public class FoobarService {

    @Inject
    @RestClient
    MyAuthenticatedService myService;

    public void foobar(String token) {
        myService.myAuthenticatedCall("Bearer " + token); // beware of the space
    }
}