public void addConsumerToken(final ApplicationLink applicationLink, final String username, final ConsumerToken consumerToken) { Preconditions.checkNotNull(applicationLink, "applicationLink"); Preconditions.checkNotNull(username, "username"); Preconditions.checkNotNull(consumerToken, "consumerToken"); verifyOAuthOutgoingEnabled(applicationLink.getId()); final Map<String, String> tokenProperties = new HashMap<String, String>(); tokenProperties.put(APPLINKS_APPLICATION_LINK_ID, applicationLink.getId().get()); final ConsumerTokenStore.Key key = makeOAuthApplinksConsumerKey(username, applicationLink.getId().get()); ConsumerToken.ConsumerTokenBuilder tokenBuilder; if (consumerToken.isAccessToken()) { tokenBuilder = ConsumerToken.newAccessToken(consumerToken.getToken()); } else { tokenBuilder = ConsumerToken.newRequestToken(consumerToken.getToken()); } tokenBuilder.tokenSecret(consumerToken.getTokenSecret()).consumer(consumerToken.getConsumer()).properties(tokenProperties); consumerTokenStore.put(key, tokenBuilder.build()); }