本文整理汇总了Java中mesosphere.marathon.client.auth.TokenAuthRequestInterceptor类的典型用法代码示例。如果您正苦于以下问题:Java TokenAuthRequestInterceptor类的具体用法?Java TokenAuthRequestInterceptor怎么用?Java TokenAuthRequestInterceptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TokenAuthRequestInterceptor类属于mesosphere.marathon.client.auth包,在下文中一共展示了TokenAuthRequestInterceptor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //导入依赖的package包/类
public Marathon build() {
if (null == listOfServers) {
if (!StringUtils.isEmpty(token)) {
return getInstanceWithTokenAuth(baseEndpoint, token);
} else if (!StringUtils.isEmpty(username)) {
return getInstanceWithBasicAuth(baseEndpoint, username, password);
} else {
return getInstance(baseEndpoint);
}
} else {
setMarathonRibbonProperty("listOfServers", listOfServers);
setMarathonRibbonProperty("OkToRetryOnAllOperations", Boolean.TRUE.toString());
setMarathonRibbonProperty("MaxAutoRetriesNextServer", maxRetryCount);
setMarathonRibbonProperty("ConnectTimeout", connectionTimeout);
setMarathonRibbonProperty("ReadTimeout", readTimeout);
Feign.Builder builder = Feign.builder()
.client(RibbonClient.builder().lbClientFactory(new MarathonLBClientFactory()).build())
.encoder(new GsonEncoder(ModelUtils.GSON))
.decoder(new GsonDecoder(ModelUtils.GSON))
.errorDecoder(new MarathonErrorDecoder());
if (!StringUtils.isEmpty(token)) {
builder.requestInterceptor(new TokenAuthRequestInterceptor(token));
}
else if (!StringUtils.isEmpty(username)) {
builder.requestInterceptor(new BasicAuthRequestInterceptor(username,password));
}
builder.requestInterceptor(new MarathonHeadersInterceptor());
return builder.target(Marathon.class, DEFAULT_MARATHON_ENDPOINT);
}
}
示例2: createMarathonClient
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //导入依赖的package包/类
private static Marathon createMarathonClient() {
String token = LoginClient.getAuthToken(LOGIN_URL);
return getInstance(ENDPOINT, new TokenAuthRequestInterceptor(token));
}
示例3: getInstanceWithTokenAuth
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //导入依赖的package包/类
public static Metronome getInstanceWithTokenAuth(String endpoint, String token) {
return getInstance(endpoint, new TokenAuthRequestInterceptor(token));
}
示例4: createMetronomeClient
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //导入依赖的package包/类
private static Metronome createMetronomeClient() {
String token = LoginClient.getAuthToken(LOGIN_URL);
return MetronomeClient.getInstance(ENDPOINT, new TokenAuthRequestInterceptor(token));
}
示例5: getInstanceWithTokenAuth
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //导入依赖的package包/类
/**
* Creates a Marathon client proxy that uses a token for authentication.
*
* @param endpoint URL of Marathon
* @param token token
* @return Marathon client
*/
public static Marathon getInstanceWithTokenAuth(String endpoint, String token) {
return getInstance(endpoint, new TokenAuthRequestInterceptor(token));
}