Package com.dietsodasoftware.yail.oauth2.client

Examples of com.dietsodasoftware.yail.oauth2.client.Scope


        this.parse = parse;
    }

    @Override
    public void attemptAuthorization(OAuthAuthenticationHandler handler) throws IOException, OauthAuthenticationException {
        final BrowserAuthorityBridge browser = new BrowserAuthorityBridge(clientId, scopes);
        if(username != null && password != null){
            browser.usingBasicAuth(username, password);
        }
        browser.showBrowser();

        final String requestUuid = browser.getRequestUuid();
        final ParseTokenResourceService tokenService = new ParseTokenResourceService(parse);
        final ParseTokenStatePollingTask pollingTask = tokenService.createTokenPollingTask(requestUuid, maxAttempts, handler);

        final ScheduledFuture future = executorService.scheduleWithFixedDelay(pollingTask, initialDelaySeconds, delaySeconds, TimeUnit.SECONDS);
        pollingTask.setMyFuture(future);
View Full Code Here


                .withScheduledExecutorService(executorService)
                .withMaxAttempts(100)
                .build(parse);


        final InfusionsoftOauthAuthenticator auth = new InfusionsoftOauthAuthenticator();

        // use this token as "API Key" in XMLRPC calls AND ?auth_token=<> URL parameter
        final InfusionsoftOauthToken token = auth.authorize2(parseAuthority, DietSodaUtils.MASHERY_CLIENT_ID, DietSodaUtils.MASHERY_CLIENT_SECRET, timeoutSeconds);

        if(token == null || token.getToken() == null){
            System.err.println("Did not get a token");
        } else {
            System.out.println("Got a auth token: " + token.getToken().substring(0, 5) + "...");
View Full Code Here


        final InfusionsoftOauthAuthenticator auth = new InfusionsoftOauthAuthenticator();

        // use this token as "API Key" in XMLRPC calls AND ?auth_token=<> URL parameter
        final InfusionsoftOauthToken token = auth.authorize2(parseAuthority, DietSodaUtils.MASHERY_CLIENT_ID, DietSodaUtils.MASHERY_CLIENT_SECRET, timeoutSeconds);

        if(token == null || token.getToken() == null){
            System.err.println("Did not get a token");
        } else {
            System.out.println("Got a auth token: " + token.getToken().substring(0, 5) + "...");
            final YailProfile profile = YailProfile.usingOAuth2Token(token);
            final YailClient client = profile.getClient();

            queryContact(client);
        }
View Full Code Here

        final String rawScopeNames = rawScope.substring(0,barIndex);

        final String[] scopeNames = rawScopeNames.split(" ");
        final List<Scope> scopes = new LinkedList<Scope>();
        for(String scopeName: scopeNames){
            final Scope scope = Scope.fromScopeName(scopeName);
            if(scope != null){
                scopes.add(scope);
            }
        }
View Full Code Here

    private void pollForAuthorizationToken() throws IOException, OauthAuthenticationException {
        final TokenCodeState tokenCodeState = tokenCodeStateResource.readTokenState(targetUuid);

        if(tokenCodeState != null){
            try{
                final ScopeContext scope = fromTokenCodeState(tokenCodeState);

                authenticationHandler.onAuthentication(scope);
                myFuture.cancel(false);
            } finally {
                // if the callback throws, I deem this unauthentiated
View Full Code Here

            if(scope != null){
                scopes.add(scope);
            }
        }

        return new ScopeContext(scopes, appName, authCode, redirectUri);
    }
View Full Code Here

        }
  }

    private <T> void verifyOperationAuthentication(InfusionsoftXmlRpcServiceOperation<T> operation) {

        final RequiresOAuth requiresOAuth = AnnotationUtils.findAnnotation(operation.getClass(), RequiresOAuth.class);
        if(requiresOAuth != null){
            if(oauthToken == null){
                throw new RuntimeException("Operation " + operation.getClass().getName() + " requires a profile authenticated using OAuth");
            }
        }
View Full Code Here

            }
        });

        final ParseConfiguration parse = DietSodaUtils.parse();

        final ParseAuthority parseAuthority = ParseAuthority.builder()
                .withClientId(DietSodaUtils.MASHERY_CLIENT_ID)
                .withScopes(Scope.Full)
                .withScheduledExecutorService(executorService)
                .withMaxAttempts(100)
                .build(parse);
View Full Code Here

                return thread;
            }
        });

        final ParseConfiguration parse = DietSodaUtils.parse();

        final ParseAuthority parseAuthority = ParseAuthority.builder()
                .withClientId(DietSodaUtils.MASHERY_CLIENT_ID)
                .withScopes(Scope.Full)
                .withScheduledExecutorService(executorService)
View Full Code Here

            browser.usingBasicAuth(username, password);
        }
        browser.showBrowser();

        final String requestUuid = browser.getRequestUuid();
        final ParseTokenResourceService tokenService = new ParseTokenResourceService(parse);
        final ParseTokenStatePollingTask pollingTask = tokenService.createTokenPollingTask(requestUuid, maxAttempts, handler);

        final ScheduledFuture future = executorService.scheduleWithFixedDelay(pollingTask, initialDelaySeconds, delaySeconds, TimeUnit.SECONDS);
        pollingTask.setMyFuture(future);

View Full Code Here

TOP

Related Classes of com.dietsodasoftware.yail.oauth2.client.Scope

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.