當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。