Package com.box.boxjavalibv2.jsonentities

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity


        final BoxConnectionManagerBuilder connectionManager = connectionManagerBuilder != null
            ? connectionManagerBuilder : new BoxConnectionManagerBuilder();

        // create REST client for BoxClient
        final ClientConnectionManager[] clientConnectionManager = new ClientConnectionManager[1];
        final IBoxRESTClient restClient = new BoxRESTClient(connectionManager.build()) {
            @Override
            public HttpClient getRawHttpClient() {
                final HttpClient httpClient = super.getRawHttpClient();
                clientConnectionManager[0] = httpClient.getConnectionManager();
                final SchemeRegistry schemeRegistry = clientConnectionManager[0].getSchemeRegistry();
View Full Code Here


        final BoxConnectionManagerBuilder connectionManager = connectionManagerBuilder != null
            ? connectionManagerBuilder : new BoxConnectionManagerBuilder();

        // create REST client for BoxClient
        final ClientConnectionManager[] clientConnectionManager = new ClientConnectionManager[1];
        final IBoxRESTClient restClient = new BoxRESTClient(connectionManager.build()) {
            @Override
            public HttpClient getRawHttpClient() {
                final HttpClient httpClient = super.getRawHttpClient();
                clientConnectionManager[0] = httpClient.getConnectionManager();
View Full Code Here

                boxClient.authenticateFromSecureStorage(authSecureStorage);
            } else {

                LOG.debug("Using OAuth {}", cachedBoxClient);
                // authorize App for user, and create OAuth token with refresh token
                final IAuthFlowUI authFlowUI = new LoginAuthFlowUI(configuration, boxClient);
                final CountDownLatch latch = new CountDownLatch(1);
                final LoginAuthFlowListener listener = new LoginAuthFlowListener(latch);
                boxClient.authenticate(authFlowUI, true, listener);

                // wait for login to finish or timeout
View Full Code Here

                boxClient.authenticateFromSecureStorage(authSecureStorage);
            } else {

                LOG.debug("Using OAuth {}", cachedBoxClient);
                // authorize App for user, and create OAuth token with refresh token
                final IAuthFlowUI authFlowUI = new LoginAuthFlowUI(configuration, boxClient);
                final CountDownLatch latch = new CountDownLatch(1);
                final LoginAuthFlowListener listener = new LoginAuthFlowListener(latch);
                boxClient.authenticate(authFlowUI, true, listener);

                // wait for login to finish or timeout
View Full Code Here

    public static CachedBoxClient createBoxClient(final BoxConfiguration configuration) {

        final String clientId = configuration.getClientId();
        final String clientSecret = configuration.getClientSecret();

        final IAuthSecureStorage authSecureStorage = configuration.getAuthSecureStorage();
        final String userName = configuration.getUserName();
        final String userPassword = configuration.getUserPassword();

        if ((authSecureStorage == null && ObjectHelper.isEmpty(userPassword))
            || ObjectHelper.isEmpty(userName) || ObjectHelper.isEmpty(clientId) || ObjectHelper.isEmpty(clientSecret)) {
View Full Code Here

                return;
            }

            LOG.debug("Getting OAuth token for {}...", cachedBoxClient);

            final IAuthSecureStorage authSecureStorage = cachedBoxClient.getSecureStorage();
            if (authSecureStorage != null && authSecureStorage.getAuth() != null) {

                LOG.debug("Using secure storage for {}", cachedBoxClient);
                // authenticate using stored refresh token
                boxClient.authenticateFromSecureStorage(authSecureStorage);
            } else {
View Full Code Here

    public static CachedBoxClient createBoxClient(final BoxConfiguration configuration) {

        final String clientId = configuration.getClientId();
        final String clientSecret = configuration.getClientSecret();

        final IAuthSecureStorage authSecureStorage = configuration.getAuthSecureStorage();
        final String userName = configuration.getUserName();
        final String userPassword = configuration.getUserPassword();

        if ((authSecureStorage == null && ObjectHelper.isEmpty(userPassword))
            || ObjectHelper.isEmpty(userName) || ObjectHelper.isEmpty(clientId) || ObjectHelper.isEmpty(clientSecret)) {
View Full Code Here

                return;
            }

            LOG.debug("Getting OAuth token for {}...", cachedBoxClient);

            final IAuthSecureStorage authSecureStorage = cachedBoxClient.getSecureStorage();
            if (authSecureStorage != null && authSecureStorage.getAuth() != null) {

                LOG.debug("Using secure storage for {}", cachedBoxClient);
                // authenticate using stored refresh token
                boxClient.authenticateFromSecureStorage(authSecureStorage);
            } else {
View Full Code Here

            options.put(entry.getKey().toString(), entry.getValue());
        }

        final BoxConfiguration configuration = new BoxConfiguration();
        IntrospectionSupport.setProperties(configuration, options);
        configuration.setAuthSecureStorage(new IAuthSecureStorage() {

            @Override
            public void saveAuth(IAuthData auth) {
                if (auth == null) {
                    // revoked
View Full Code Here

                final IBoxOAuthManager oAuthManager = boxClient.getOAuthManager();
                final BoxOAuthToken oAuthToken = oAuthManager.createOAuth(authorizationCode,
                    configuration.getClientId(), configuration.getClientSecret(), null);

                // send initial token to BoxClient and this.listener
                final OAuthDataMessage authDataMessage = new OAuthDataMessage(oAuthToken,
                    boxClient.getJSONParser(), boxClient.getResourceHub());
                listener.onAuthFlowEvent(OAuthEvent.OAUTH_CREATED, authDataMessage);
                this.listener.onAuthFlowEvent(OAuthEvent.OAUTH_CREATED, authDataMessage);
            }
View Full Code Here

TOP

Related Classes of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.