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


Java BoxOAuthRequestObject类代码示例

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


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

示例1: doRefresh

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
/**
 * Refresh the OAuth.
 * 
 * @throws BoxRestException
 *             exception
 * @throws BoxServerException
 *             exception
 * @throws AuthFatalFailureException
 *             exception
 */
private void doRefresh() throws AuthFatalFailureException {
    setTokenState(OAuthTokenState.REFRESHING);
    try {
        mOAuthToken = mClient.getOAuthManager().refreshOAuth(
            (BoxOAuthRequestObject) BoxOAuthRequestObject.refreshOAuthRequestObject(mOAuthToken.getRefreshToken(), mClientId, mClientSecret)
                .addQueryParam("device_id", mDeviceId).addQueryParam("device_name", mDeviceName));
        setTokenState(OAuthTokenState.AVAILABLE);
        if (refreshListener != null) {
            refreshListener.onRefresh(mOAuthToken);
        }

        unlock();
    }
    catch (Exception e) {
        setTokenState(OAuthTokenState.FAIL);
        throw new AuthFatalFailureException(true);
    }
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:29,代码来源:OAuthDataController.java

示例2: startCreateOAuth

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
private void startCreateOAuth(final String code) {
    if (oauthCreated.getAndSet(true)) {
        return;
    }

    Thread t = new Thread() {

        @Override
        public void run() {
            BoxOAuthToken oauth = null;
            try {
                oauth = client.getOAuthManager().createOAuth(
                    BoxOAuthRequestObject.createOAuthRequestObject(code, mWebViewData.getClientId(), mWebViewData.getClientSecret(),
                        mWebViewData.getRedirectUrl()));
                exitSuccess(oauth);
            }
            catch (Exception e) {
                exitException(e);
            }
        }
    };
    t.start();
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:24,代码来源:JavaFxOAuthFlow.java

示例3: createBoxClient

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
private static BoxClient createBoxClient(final String code, final String clientId, final String secret) throws BoxRestException, BoxServerException, AuthFatalFailureException {
    final BoxResourceHub hub = new BoxResourceHub();
    final BoxJSONParser parser = new BoxJSONParser(hub);
    final BoxClient client = new BoxClient(clientId, secret, hub, parser);
    final BoxOAuthRequestObject oAuthRequestObject = BoxOAuthRequestObject.createOAuthRequestObject(code, clientId, secret, null);
    final BoxOAuthToken bt = client.getOAuthManager().createOAuth(oAuthRequestObject);
    client.authenticate(bt);
    return client;
}
 
开发者ID:a-jullien,项目名称:cirrus,代码行数:10,代码来源:BoxStorageService.java

示例4: testRevokeRequestObject

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
@Test
public void testRevokeRequestObject() throws BoxRestException {
    String token = "testtoken1212";
    BoxOAuthRequestObject obj = BoxOAuthRequestObject.revokeOAuthRequestObject(token, CLIENT_ID, CLIENT_SECRET);
    MapJSONStringEntity jEntity = obj.getJSONEntity();
    Assert.assertEquals(CLIENT_ID, jEntity.get("client_id"));
    Assert.assertEquals(CLIENT_SECRET, jEntity.get("client_secret"));
    Assert.assertEquals(token, jEntity.get("token"));
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:10,代码来源:BoxOAuthRequestObjectTest.java

示例5: testCreateRequestObject

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
@Test
public void testCreateRequestObject() throws BoxRestException {
    String code = "testcode";
    String url = "testurl";
    BoxOAuthRequestObject obj = BoxOAuthRequestObject.createOAuthRequestObject(code, CLIENT_ID, CLIENT_SECRET, url);
    MapJSONStringEntity jEntity = obj.getJSONEntity();
    Assert.assertEquals(CLIENT_ID, jEntity.get("client_id"));
    Assert.assertEquals(CLIENT_SECRET, jEntity.get("client_secret"));
    Assert.assertEquals(code, jEntity.get("code"));
    Assert.assertEquals(url, jEntity.get("redirect_url"));
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:12,代码来源:BoxOAuthRequestObjectTest.java

示例6: testRefreshRequestObject

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
@Test
public void testRefreshRequestObject() throws BoxRestException {
    String token = "testrefreshtoken";
    BoxOAuthRequestObject obj = BoxOAuthRequestObject.refreshOAuthRequestObject(token, CLIENT_ID, CLIENT_SECRET);
    MapJSONStringEntity jEntity = obj.getJSONEntity();
    Assert.assertEquals(CLIENT_ID, jEntity.get("client_id"));
    Assert.assertEquals(CLIENT_SECRET, jEntity.get("client_secret"));
    Assert.assertEquals(token, jEntity.get("refresh_token"));
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:10,代码来源:BoxOAuthRequestObjectTest.java

示例7: refreshOAuth

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
@Override
public BoxOAuthToken refreshOAuth(final BoxOAuthRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException {
    if (refreshShouldFail) {
        throw new AuthFatalFailureException();
    }
    // Let's say refreshing a token takes 1 second.
    try {
        Thread.sleep(1000);
    }
    catch (InterruptedException e) {
        e.printStackTrace();
    }
    return createMockToken(MockRestClient.accessToken);
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:15,代码来源:MockOAuthManager.java

示例8: revokeOAuth

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
public void revokeOAuth(final BoxOAuthRequestObject requestObject) throws BoxServerException, BoxRestException, AuthFatalFailureException {
    RevokeOAuthRequest request = new RevokeOAuthRequest(getConfig(), getObjectMapper(), requestObject);
    executeRequestWithNoResponseBody(request);
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:5,代码来源:BoxOAuthManager.java

示例9: RevokeOAuthRequest

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
public RevokeOAuthRequest(IBoxConfig config, ObjectMapper objectMapper, BoxOAuthRequestObject requestObject) throws BoxRestException {
    super(config, objectMapper, getUri(), RestMethod.POST, requestObject);
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:4,代码来源:RevokeOAuthRequest.java

示例10: createOAuth

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
@Override
public BoxOAuthToken createOAuth(BoxOAuthRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException {
    return createMockToken(MockRestClient.accessToken);
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:5,代码来源:MockOAuthManager.java

示例11: createOAuth

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
/**
 * Create an OAuth token.
 * 
 * @param requestObject
 *            request object
 * @return OAuth data object
 * @throws BoxRestException
 *             exception
 * @throws BoxServerException
 *             exception
 * @throws AuthFatalFailureException
 *             exception
 */
public BoxOAuthToken createOAuth(BoxOAuthRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException {
    CreateOAuthRequest request = new CreateOAuthRequest(getConfig(), getObjectMapper(), requestObject);
    return (BoxOAuthToken) getResponseAndParseAndTryCast(request, BoxResourceType.OAUTH_DATA, getObjectMapper());
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:18,代码来源:BoxOAuthManager.java

示例12: refreshOAuth

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
/**
 * Refresh the OAuth token.
 * 
 * @param requestObject
 *            request object
 * @return OAuth data object
 * @throws BoxRestException
 *             exception
 * @throws BoxServerException
 *             exception
 * @throws AuthFatalFailureException
 *             exception
 */
public BoxOAuthToken refreshOAuth(final BoxOAuthRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException {
    RefreshOAuthRequest request = new RefreshOAuthRequest(getConfig(), getObjectMapper(), requestObject);
    return (BoxOAuthToken) getResponseAndParseAndTryCast(request, BoxResourceType.OAUTH_DATA, getObjectMapper());
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:18,代码来源:BoxOAuthManager.java

示例13: CreateOAuthRequest

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param config
 *            config
 * @param objectMapper
 *            object mapper
 * @param requestObject
 *            request object
 * @throws BoxRestException
 *             except
 */
public CreateOAuthRequest(final IBoxConfig config, final ObjectMapper objectMapper, BoxOAuthRequestObject requestObject) throws BoxRestException {
    super(config, objectMapper, getUri(), RestMethod.POST, requestObject);
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:16,代码来源:CreateOAuthRequest.java

示例14: RefreshOAuthRequest

import com.box.boxjavalibv2.requests.requestobjects.BoxOAuthRequestObject; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param config
 *            config
 * @param objectMapper
 *            object mapper
 * @param requestObject
 *            request object
 * @throws BoxRestException
 *             exception
 */
public RefreshOAuthRequest(final IBoxConfig config, final ObjectMapper objectMapper, final BoxOAuthRequestObject requestObject) throws BoxRestException {
    super(config, objectMapper, getUri(), RestMethod.POST, requestObject);
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:16,代码来源:RefreshOAuthRequest.java


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