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


Java OAuth类代码示例

本文整理汇总了Java中io.swagger.client.auth.OAuth的典型用法代码示例。如果您正苦于以下问题:Java OAuth类的具体用法?Java OAuth怎么用?Java OAuth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OAuth类属于io.swagger.client.auth包,在下文中一共展示了OAuth类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureAuthorizationFlow

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure the oauth accessCode/implicit flow parameters
 * @param clientId Client ID
 * @param clientSecret Client secret
 * @param redirectURI Redirect URI
 */
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.getTokenRequestBuilder()
                    .setClientId(clientId)
                    .setClientSecret(clientSecret)
                    .setRedirectURI(redirectURI);
            oauth.getAuthenticationRequestBuilder()
                    .setClientId(clientId)
                    .setRedirectURI(redirectURI);
            return;
        }
    }
}
 
开发者ID:amardeshbd,项目名称:medium-api-android-sample,代码行数:22,代码来源:ApiClient.java

示例2: configureAuthorizationFlow

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure the oauth accessCode/implicit flow parameters
 * @param clientId
 * @param clientSecret
 * @param redirectURI
 */
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.getTokenRequestBuilder()
                    .setClientId(clientId)
                    .setClientSecret(clientSecret)
                    .setRedirectURI(redirectURI);
            oauth.getAuthenticationRequestBuilder()
                    .setClientId(clientId)
                    .setRedirectURI(redirectURI);
            return;
        }
    }
}
 
开发者ID:hardsky,项目名称:lucky-calories,代码行数:22,代码来源:ApiClient.java

示例3: initializeApiClient

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
private void initializeApiClient() throws RetrofitError {
    ApiClient apiClient = new ApiClient();

    OAuth auth = new OAuth(new TrustingOkHttpClient(),
            OAuthClientRequest.tokenLocation("https://api.netatmo.net/oauth2/token"));
    auth.setFlow(OAuthFlow.password);
    auth.setAuthenticationRequestBuilder(OAuthClientRequest.authorizationLocation(""));

    apiClient.getApiAuthorizations().put("password_oauth", auth);
    apiClient.getTokenEndPoint().setClientId(configuration.clientId).setClientSecret(configuration.clientSecret)
            .setUsername(configuration.username).setPassword(configuration.password).setScope(getApiScope());

    apiClient.configureFromOkclient(new TrustingOkHttpClient());
    apiClient.getAdapterBuilder().setLogLevel(logger.isDebugEnabled() ? LogLevel.FULL : LogLevel.NONE);

    apiMap = new APIMap(apiClient);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:18,代码来源:NetatmoBridgeHandler.java

示例4: setCredentials

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure the username/password for basic auth or password oauth
 * @param username Username
 * @param password Password
 */
private void setCredentials(String username, String password) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof HttpBasicAuth) {
            HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
            basicAuth.setCredentials(username, password);
            return;
        }
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
            return;
        }
    }
}
 
开发者ID:amardeshbd,项目名称:medium-api-android-sample,代码行数:20,代码来源:ApiClient.java

示例5: getTokenEndPoint

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Token request builder
 */
public TokenRequestBuilder getTokenEndPoint() {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            return oauth.getTokenRequestBuilder();
        }
    }
    return null;
}
 
开发者ID:amardeshbd,项目名称:medium-api-android-sample,代码行数:14,代码来源:ApiClient.java

示例6: getAuthorizationEndPoint

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Authentication request builder
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            return oauth.getAuthenticationRequestBuilder();
        }
    }
    return null;
}
 
开发者ID:amardeshbd,项目名称:medium-api-android-sample,代码行数:14,代码来源:ApiClient.java

示例7: setAccessToken

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
 * @param accessToken Access token
 */
public void setAccessToken(String accessToken) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.setAccessToken(accessToken);
            return;
        }
    }
}
 
开发者ID:amardeshbd,项目名称:medium-api-android-sample,代码行数:14,代码来源:ApiClient.java

示例8: registerAccessTokenListener

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Configures a listener which is notified when a new access token is received.
 * @param accessTokenListener Access token listener
 */
public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.registerAccessTokenListener(accessTokenListener);
            return;
        }
    }
}
 
开发者ID:amardeshbd,项目名称:medium-api-android-sample,代码行数:14,代码来源:ApiClient.java

示例9: setAccessToken

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to set access token for the first OAuth2 authentication.
 *
 * @param accessToken Access token
 */
public void setAccessToken(String accessToken) {
    for (Authentication auth : authentications.values()) {
        if (auth instanceof OAuth) {
            ((OAuth) auth).setAccessToken(accessToken);
            return;
        }
    }
    throw new RuntimeException("No OAuth2 authentication configured!");
}
 
开发者ID:simplesteph,项目名称:nifi-api-client-java,代码行数:15,代码来源:ApiClient.java

示例10: setCredentials

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure the username/password for basic auth or password oauth
 * @param username
 * @param password
 */
private void setCredentials(String username, String password) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof HttpBasicAuth) {
            HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
            basicAuth.setCredentials(username, password);
            return;
        }
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
            return;
        }
    }
}
 
开发者ID:hardsky,项目名称:lucky-calories,代码行数:20,代码来源:ApiClient.java

示例11: getTokenEndPoint

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return
 */
public TokenRequestBuilder getTokenEndPoint() {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            return oauth.getTokenRequestBuilder();
        }
    }
    return null;
}
 
开发者ID:hardsky,项目名称:lucky-calories,代码行数:14,代码来源:ApiClient.java

示例12: getAuthorizationEndPoint

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            return oauth.getAuthenticationRequestBuilder();
        }
    }
    return null;
}
 
开发者ID:hardsky,项目名称:lucky-calories,代码行数:14,代码来源:ApiClient.java

示例13: setAccessToken

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
 * @param accessToken
 */
public void setAccessToken(String accessToken) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.setAccessToken(accessToken);
            return;
        }
    }
}
 
开发者ID:hardsky,项目名称:lucky-calories,代码行数:14,代码来源:ApiClient.java

示例14: registerAccessTokenListener

import io.swagger.client.auth.OAuth; //导入依赖的package包/类
/**
 * Configures a listener which is notified when a new access token is received.
 * @param accessTokenListener
 */
public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
    for(Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof OAuth) {
            OAuth oauth = (OAuth) apiAuthorization;
            oauth.registerAccessTokenListener(accessTokenListener);
            return;
        }
    }
}
 
开发者ID:hardsky,项目名称:lucky-calories,代码行数:14,代码来源:ApiClient.java

示例15: ApiClient

import io.swagger.client.auth.OAuth; //导入依赖的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 <code>parseDatetime</code>.
    this.lenientDatetimeFormat = true;

    // Set default User-Agent.
    setUserAgent("Swagger-Codegen/1.0.0/java");

    // Setup authentications (key: authentication name, value: authentication).
    authentications = new HashMap<String, Authentication>();
    authentications.put("psirt_openvuln_api_auth", new OAuth());
    // Prevent the authentications from being modified.
    authentications = Collections.unmodifiableMap(authentications);
}
 
开发者ID:CiscoPSIRT,项目名称:openVulnAPI,代码行数:30,代码来源:ApiClient.java


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