java authkey_Java ApiKeyAuth類代碼示例

本文整理匯總了Java中io.swagger.client.auth.ApiKeyAuth類的典型用法代碼示例。如果您正苦於以下問題:Java ApiKeyAuth類的具體用法?Java ApiKeyAuth怎麽用?Java ApiKeyAuth使用的例子?那麽恭喜您, 這裏精選的類代碼示例或許可以為您提供幫助。

ApiKeyAuth類屬於io.swagger.client.auth包,在下文中一共展示了ApiKeyAuth類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: setApiKey

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to set API key value for the first API key authentication.

*/

public void setApiKey(String apiKey) {

for (Authentication auth : authentications.values()) {

if (auth instanceof ApiKeyAuth) {

((ApiKeyAuth) auth).setApiKey(apiKey);

return;

}

}

throw new RuntimeException("No API key authentication configured!");

}

開發者ID:wondenge,項目名稱:payments-Android-SDK,代碼行數:13,

示例2: setApiKeyPrefix

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to set API key prefix for the first API key authentication.

*/

public void setApiKeyPrefix(String apiKeyPrefix) {

for (Authentication auth : authentications.values()) {

if (auth instanceof ApiKeyAuth) {

((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);

return;

}

}

throw new RuntimeException("No API key authentication configured!");

}

開發者ID:wondenge,項目名稱:payments-Android-SDK,代碼行數:13,

示例3: setAuth

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

private static boolean setAuth(String method) {

if (method != null && !method.isEmpty()) {

ApiKeyAuth auth = (ApiKeyAuth) client.getAuthentication(method);

auth.setApiKey(dataProvider.getCurrentUserUid());

return true;

}

return false;

}

開發者ID:WGPlaner,項目名稱:wg_planer,代碼行數:10,

示例4: setApiKey

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to configure the first api key found

* @param apiKey API key

*/

private void setApiKey(String apiKey) {

for(Interceptor apiAuthorization : apiAuthorizations.values()) {

if (apiAuthorization instanceof ApiKeyAuth) {

ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;

keyAuth.setApiKey(apiKey);

return;

}

}

}

開發者ID:amardeshbd,項目名稱:medium-api-android-sample,代碼行數:14,

示例5: setApiKey

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to set API key value for the first API key authentication.

*

* @param apiKey API key

*/

public void setApiKey(String apiKey) {

for (Authentication auth : authentications.values()) {

if (auth instanceof ApiKeyAuth) {

((ApiKeyAuth) auth).setApiKey(apiKey);

return;

}

}

throw new RuntimeException("No API key authentication configured!");

}

開發者ID:Tradeshift,項目名稱:tradeshift-platform-sdk,代碼行數:15,

示例6: setApiKeyPrefix

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to set API key prefix for the first API key authentication.

*

* @param apiKeyPrefix API key prefix

*/

public void setApiKeyPrefix(String apiKeyPrefix) {

for (Authentication auth : authentications.values()) {

if (auth instanceof ApiKeyAuth) {

((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);

return;

}

}

throw new RuntimeException("No API key authentication configured!");

}

開發者ID:Tradeshift,項目名稱:tradeshift-platform-sdk,代碼行數:15,

示例7: initializeInstance

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {

INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);

setUserAgent("Swagger-Codegen/1.0.0/android");

// Setup authentications (key: authentication name, value: authentication).

INSTANCE.authentications = new HashMap();

INSTANCE.authentications.put("Bearer", new ApiKeyAuth("header", "Authorization"));

// Prevent the authentications from being modified.

INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);

}

開發者ID:eurofurence,項目名稱:ef-app_android,代碼行數:11,

示例8: setApiKey

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to set API key value for the first API key authentication.

*/

public void setApiKey(String apiKey) {

for (Authentication auth : authentications.values()) {

if (auth instanceof ApiKeyAuth) {

((ApiKeyAuth) auth).setApiKey(apiKey);

return;

}

}

throw new RuntimeException("No API key authentication configured!");

}

開發者ID:eurofurence,項目名稱:ef-app_android,代碼行數:13,

示例9: setApiKeyPrefix

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to set API key prefix for the first API key authentication.

*/

public void setApiKeyPrefix(String apiKeyPrefix) {

for (Authentication auth : authentications.values()) {

if (auth instanceof ApiKeyAuth) {

((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);

return;

}

}

throw new RuntimeException("No API key authentication configured!");

}

開發者ID:eurofurence,項目名稱:ef-app_android,代碼行數:13,

示例10: ApiClient

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

public ApiClient() {

httpClient = new OkHttpClient();

verifyingSsl = true;

json = new JSON(this);

/*

* Use RFC3339 format for date and datetime.

* See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14

*/

this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");

// Always use UTC as the default time zone when dealing with date (without time).

this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

initDatetimeFormat();

// Be lenient on datetime formats when parsing datetime from string.

// See parseDatetime.

this.lenientDatetimeFormat = true;

// Set default User-Agent.

setUserAgent("Swagger-Codegen/1.0.0/java");

// Setup authentications (key: authentication name, value: authentication).

authentications = new HashMap();

authentications.put("access-token", new ApiKeyAuth("header", "access-token"));

authentications.put("client-id", new ApiKeyAuth("header", "client-id"));

authentications.put("merchant-id", new ApiKeyAuth("header", "merchant-id"));

// Prevent the authentications from being modified.

authentications = Collections.unmodifiableMap(authentications);

}

開發者ID:DeveloperCielo,項目名稱:LIO-SDK-API-Integracao-Remota-v1-Java,代碼行數:33,

示例11: createClient

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

public static LuckyCaloriesApi createClient(String access_token){

Gson gson = new GsonBuilder()

.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")

.create();

//String baseUrl = "http://localhost:4003/api/v1";

String baseUrl = "http://10.0.2.2:4003/api/v1"; //from emulator to host computer (localhost)

if(!baseUrl.endsWith("/"))

baseUrl = baseUrl + "/";

OkHttpClient.Builder okHttpBuilder = new OkHttpClient.Builder();

if(access_token != null){

ApiKeyAuth authInterceptor = new ApiKeyAuth("header", "access_token");

authInterceptor.setApiKey(access_token);

okHttpBuilder.addInterceptor(authInterceptor);

}

Retrofit retrofit = new Retrofit

.Builder()

.baseUrl(baseUrl)

.client(okHttpBuilder.build())

.addConverterFactory(ScalarsConverterFactory.create())

.addConverterFactory(GsonCustomConverterFactory.create(gson))

.build();

return retrofit.create(LuckyCaloriesApi.class);

}

開發者ID:hardsky,項目名稱:lucky-calories,代碼行數:31,

示例12: setApiKey

​點讚 2

import io.swagger.client.auth.ApiKeyAuth; //導入依賴的package包/類

/**

* Helper method to configure the first api key found

* @param apiKey

*/

private void setApiKey(String apiKey) {

for(Interceptor apiAuthorization : apiAuthorizations.values()) {

if (apiAuthorization instanceof ApiKeyAuth) {

ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;

keyAuth.setApiKey(apiKey);

return;

}

}

}

開發者ID:hardsky,項目名稱:lucky-calories,代碼行數:14,

注:本文中的io.swagger.client.auth.ApiKeyAuth類示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值