skillifier/src/main/java/rage/services/UserService.java
public User oauthFromServer(String token) {
        if (localCache.containsKey(token)) {
            if (!localCache.get(token).hasExpired()) {
                return setupUser(localCache.get(token).getResponse().getUsername());
            }
        }
        URI url = URI.create(System.getProperty("server.external.oauth") + "?access_token=" + token);
        RestTemplate template = new RestTemplate();
        try {
            OauthResponse response = template.getForEntity(url, OauthResponse.class).getBody();
            localCache.put(token, new CachedOauth(response));
            return setupUser(response.getUsername());
        } catch (Exception e) {
            System.out.println(e.toString());
        }
        return null;
    }
/**
     * Ask the specified server about the identity
     * of the token. Find or create User accordingly.
     * @param token The OAuth token as a String
     * @return (User) User whom the token belongs to
     */
Ask the specified server about the identity
of the token. Find or create User accordingly.
@param token The OAuth token as a String
@return (User) User whom the token belongs to
Ask the specified server about the identity of the token . Find or create User accordingly . @param token The OAuth token as a String @return ( User ) User whom the token belongs to
public User oauthFromServer(String token) {
        if (localCache.containsKey(token)) {
            if (!localCache.get(token).hasExpired()) {
                return setupUser(localCache.get(token).getResponse().getUsername());
            }
        }
        URI url = URI.create(System.getProperty("server.external.oauth") + "?access_token=" + token);
        RestTemplate template = new RestTemplate();
        try {
            OauthResponse response = template.getForEntity(url, OauthResponse.class).getBody();
            localCache.put(token, new CachedOauth(response));
            return setupUser(response.getUsername());
        } catch (Exception e) {
            System.out.println(e.toString());
        }
        return null;
    }
public User oauthFromServer ( String token ) { if ( localCache . containsKey ( token ) ) { if ( ! localCache . get ( token ) . hasExpired ( ) ) { return setupUser ( localCache . get ( token ) . getResponse ( ) . getUsername ( ) ) ; } } URI url = URI . create ( System . getProperty ( "server.external.oauth" ) + "?access_token=" + token ) ; RestTemplate template = new RestTemplate ( ) ; try { OauthResponse response = template . getForEntity ( url , OauthResponse . class ) . getBody ( ) ; localCache . put ( token , new CachedOauth ( response ) ) ; return setupUser ( response . getUsername ( ) ) ; } catch ( Exception e ) { System . out . println ( e . toString ( ) ) ; } return null ; }
Ask the specified server about the identity
 of the token.
Ask the specified server about the identity of the token .