Package org.restlet.ext.oauth

Examples of org.restlet.ext.oauth.AuthenticatedUser


    public boolean containsUser(String userId) {
        return users.contains(new AuthenticatedUserImpl(userId, this));
    }

    public AuthenticatedUser createUser(String id) {
        AuthenticatedUser user = new AuthenticatedUserImpl(id, this);
        users.add(user);
        return user;
    }
View Full Code Here


            for (String s : scopes)
                ref.addQueryParameter("scope", s);
        }

        // Granted
        AuthenticatedUser user = client.findUser(session.getScopeOwner());

        if (user != null) { // null before first code generated
            // scopes = OAuthUtils.roluser.getGrantedScopes();
            List<Role> roles = user.getGrantedRoles();
            if (roles != null && roles.size() > 0) {
                for (Role r : roles)
                    ref.addQueryParameter("grantedScope", Scopes.toScope(r));
            }
        }
View Full Code Here

    @Override
    public String generateCode(AuthenticatedUser user) {
        String code = super.generateCode(user);

        // Store the code for later use
        AuthenticatedUser oldValue = codeStore.put(code, user);
        // Something is wrong in the code generation!
        // log("WARNIG - bad generation ALG!");
        if (oldValue != null)
            oldValue.setCode(code);

        return code;
    }
View Full Code Here

    @Override
    public Token exchangeForToken(String code, long expire)
            throws IllegalArgumentException {
        // TODO handle exp tokens
        AuthenticatedUser user = codeStore.remove(code);
        // if( expire > 0 ) user.setExpire(expire);
        if (user == null)
            throw new IllegalArgumentException("Code not valid");
        Token t = generateToken(user, expire);
        user.clearCode(); // TODO could also match if the user code matches
                          // codestore
        return t;
    }
View Full Code Here

TOP

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

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.