当前位置: 首页>>代码示例>>Java>>正文


Java TokenAuthRequestInterceptor类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:aatarasoff,项目名称:spring-cloud-marathon,代码行数:35,代码来源:RibbonMarathonClient.java

示例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));
}
 
开发者ID:pravega,项目名称:pravega,代码行数:5,代码来源:AuthEnabledMarathonClient.java

示例3: getInstanceWithTokenAuth

import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //导入依赖的package包/类
public static Metronome getInstanceWithTokenAuth(String endpoint, String token) {
    return getInstance(endpoint, new TokenAuthRequestInterceptor(token));
}
 
开发者ID:pravega,项目名称:pravega,代码行数:4,代码来源:MetronomeClient.java

示例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));
}
 
开发者ID:pravega,项目名称:pravega,代码行数:5,代码来源:AuthEnabledMetronomeClient.java

示例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));
}
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:11,代码来源:MarathonClient.java


注:本文中的mesosphere.marathon.client.auth.TokenAuthRequestInterceptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。