Examples of OAuthAuthorization


Examples of com.box.boxjavalibv2.authorization.OAuthAuthorization

    public IAuthDataController createAuthDataController(final String clientId, final String clientSecret) {
        return new OAuthDataController(this, clientId, clientSecret, DEFAULT_AUTO_REFRESH);
    }

    public IBoxRequestAuth createAuthorization(IAuthDataController controller) {
        return new OAuthAuthorization((OAuthDataController) authController);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.authorization.OAuthAuthorization

    /**
     * From auth data controller, generate IBoxRequestAuth, which can be applied to api requests.
     */
    protected IBoxRequestAuth createAuthorization(IAuthDataController controller) {
        return new OAuthAuthorization((OAuthDataController) authController);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.authorization.OAuthAuthorization

        };
    }

    private int makeRequestAndGetStatusCode() throws BoxRestException, AuthFatalFailureException {
        MockRequest request = new MockRequest();
        request.setAuth(new OAuthAuthorization(client.getOAuthDataController()));
        MockRestClient client = new MockRestClient();
        DefaultBoxResponse response = (DefaultBoxResponse) client.execute(request);
        return response.getResponseStatusCode();
    }
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

    @Override
    public void setOAuthAppId(String appId, String appSecret) {
        super.setOAuthAppId(appId, appSecret);
        if (auth instanceof MockAuthorization) {
            OAuthAuthorization oauth = new OAuthAuthorization(conf);
            oauth.setOAuthAppId(appId, appSecret);
            this.auth = oauth;
        }
    }
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

        }
    }

    public void setAppSecretProofEnabled(boolean appSecretProofEnabled) {
        if (auth instanceof MockAuthorization) {
            OAuthAuthorization oauth = new OAuthAuthorization(conf);
            oauth.setAppSecretProofEnabled(appSecretProofEnabled);
            this.auth = oauth;
        } else
        if (auth instanceof OAuthAuthorization) {
            ((OAuthAuthorization) auth).setAppSecretProofEnabled(appSecretProofEnabled);
        }
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

            // try to populate OAuthAuthorization if available in the configuration
            String appId = conf.getOAuthAppId();
            String appSecret = conf.getOAuthAppSecret();
            // try to find oauth tokens in the configuration
            if (appId != null && appSecret != null) {
                OAuthAuthorization oauth = new OAuthAuthorization(conf);
                String accessToken = conf.getOAuthAccessToken();
                String callbackURL = conf.getOAuthCallbackURL();
                if (accessToken != null) {
                    if (callbackURL != null) {
                        oauth.setOAuthAccessToken(new AccessToken(accessToken, null), callbackURL);
                    } else {
                        oauth.setOAuthAccessToken(new AccessToken(accessToken, null));
                    }
                }
                this.auth = oauth;
            } else {
                this.auth = NullAuthorization.getInstance();
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

        }
        if (appSecret == null) {
            throw new NullPointerException("app secret is null");
        }
        if (auth instanceof NullAuthorization) {
            OAuthAuthorization oauth = new OAuthAuthorization(conf);
            oauth.setOAuthAppId(appId, appSecret);
            this.auth = oauth;
        } else
        if (auth instanceof OAuthAuthorization) {
            throw new IllegalStateException("app id/secret pair already set.");
        }
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

        if (facebook == null) {
            final Configuration configuration = getConfiguration();
            FacebookFactory factory = new FacebookFactory(configuration);
            if (this.oAuthAccessToken == null) {
                // app login
                facebook = factory.getInstance(new OAuthAuthorization(configuration));
                // also get the App access token
                facebook.getOAuthAppAccessToken();
                LOG.warn("Login with app id and secret, access to some APIs is restricted!");
            } else {
                // user login with token
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

            RequestMethod method = RequestMethod.GET;
            String url = "https://graph.facebook.com/foo/bar";
            HttpParameter[] parameters = new HttpParameter[1];
            parameters[0] = new HttpParameter("hoge", "1");
            ConfigurationBuilder cb = new ConfigurationBuilder().setOAuthAccessToken("access_token");
            OAuthAuthorization authorization = new OAuthAuthorization(cb.build());
            Map<String, String> requestHeaders = new HashMap<String, String>();

            HttpRequest actual = new HttpRequest(method, url, parameters, authorization, requestHeaders);
            assertThat(new URL(actual.getURL()), is(pathOf("/foo/bar")));
            assertThat(new URL(actual.getURL()), hasParameter("access_token", "access_token"));
View Full Code Here

Examples of facebook4j.auth.OAuthAuthorization

            RequestMethod method = RequestMethod.POST;
            String url = "https://graph.facebook.com/foo/bar";
            HttpParameter[] parameters = new HttpParameter[1];
            parameters[0] = new HttpParameter("hoge", "1");
            ConfigurationBuilder cb = new ConfigurationBuilder().setOAuthAccessToken("access_token");
            OAuthAuthorization authorization = new OAuthAuthorization(cb.build());
            Map<String, String> requestHeaders = new HashMap<String, String>();

            HttpRequest actual = new HttpRequest(method, url, parameters, authorization, requestHeaders);
            assertThat(actual.getURL(), is("https://graph.facebook.com/foo/bar"));
            assertThat(actual.getParameters().length, is(2));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.