Package org.restlet.ext.oauth

Examples of org.restlet.ext.oauth.Client


        String clientId = callback.getClientId();
        String clientSecret = callback.getClientSecret();
        // TODO maybe have to add callbackUrl if other back scenario then none
        // flow

        Client client = clients.findById(clientId);

        if (client == null)
            client = clients.createClient(clientId, clientSecret, /* redirUri */
            null);

View Full Code Here


        return createClient(clientId, null, redirectUri);
    }

    public Client createClient(String clientId, String clientSecret,
            String redirectUri) {
        Client client = new ClientImpl(clientId, clientSecret, redirectUri);
        clients.put(clientId, client);
        return client;
    }
View Full Code Here

        }

        if (id != null && session != null && session.getClient() != null) {
            getLogger().info("After Authentication - cleanup");
            params.removeFirst(OPENID);
            Client client = (Client) session.getClient();
            getLogger().info("Found client = " + client);
            session.setScopeOwner(id);
            return doPostAuthenticate(session, client);
        }
View Full Code Here

            getLogger().info("No mandatory redirect URI provided");
            return;
        }

        // Check that clientID and redirURI match
        Client client = clients.findById(clientId);
        getLogger().info("Client = " + client);

        if (client == null) {
            // client = clients.createClient(clientId, redirUri);
            sendError(sessionId, OAuthError.INVALID_CLIENT,
                    params.getFirstValue(STATE),
                    "Need to register the client : " + clientId, null);
            getLogger().info("Need to register the client : " + clientId);
            return;
        }

        getLogger().info(
                "Compare client redir:provided redir = "
                        + client.getRedirectUri() + ":" + redirUri);

        if (!redirUri.startsWith(client.getRedirectUri())) {
            sendError(sessionId, OAuthError.REDIRECT_URI_MISMATCH,
                    params.getFirstValue(STATE),
                    "Callback URI does not match.", null);
            getLogger().info("Callback URI does not match.");
            return;
        }

        // Set the real redir URI since it might be longer then the entered one

        // Cookie or OpenID
        if (session != null && session.getScopeOwner() != null) {

            if (flow.equals(ResponseType.token)
                    || flow.equals(ResponseType.code)) {

                String[] requestedScopes = parseScope(params
                        .getFirstValue(SCOPE));
                for (String scope : requestedScopes) {
                    getLogger().info("Requested scopes = " + scope);
                }

                session.setClient(client);
                session.setAuthFlow(flow);
                session.setRequestedScope(requestedScopes);

                // Dynamic URL- we know that the base is same
                // Might be used to allow more fine grained path or query params
                if (!redirUri.equals(client.getRedirectUri())) {
                    session.setDynamicCallbackURI(redirUri);
                    getLogger().info(
                            "OAuth2 set dynamic callback = " + redirUri);
                }
View Full Code Here

TOP

Related Classes of org.restlet.ext.oauth.Client

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.