@PUT @Path("service-provider/{applinkId}/{username}") public Response createServiceProviderAccessToken(@PathParam("applinkId") String applinkId, @PathParam("username") String username) throws TypeNotInstalledException { ServiceProviderToken accessToken = ServiceProviderToken.newAccessToken(getRandomToken()) .tokenSecret(getRandomToken()) .authorizedBy(userManager.resolve(username)) .consumer(getConsumerForApplink(new ApplicationId(applinkId))) .version(ServiceProviderToken.Version.V_1_0) .build(); serviceProviderTokenStore.put(accessToken); return Response.created(URI.create("")) .entity(new RestAccessToken(accessToken)) .build(); }
public ServiceProviderToken generateRequestToken(Consumer consumer, @Nullable URI callback, OAuthMessage message, Version version) { checkNotNull(consumer, "consumer"); String token = randomizer.randomAlphanumericString(32); String secret = randomizer.randomAlphanumericString(32); return ServiceProviderToken.newRequestToken(token) .tokenSecret(secret) .consumer(consumer) .callback(callback) .version(version) .properties(propertiesFactory.newRequestTokenProperties(Requests.fromOAuthMessage(message))) .build(); }
.consumer(ConsumerUtils.toConsumer(consumerInfo)) .callback(callback) .version(version) .build() );
.consumer(hardcodedConsumer) .callback(callback) .version(Version.V_1_0_A) .build(); store.put(nonAuthorizedRequestTokenForAuthorizing); .consumer(hardcodedConsumer) .callback(callback) .version(Version.V_1_0_A) .build(); store.put(nonAuthorizedRequestTokenForDenying); .consumer(hardcodedConsumer) .callback(callback) .version(Version.V_1_0_A) .build(); store.put(spareNonAuthorizedRequestToken); .tokenSecret("xei1kohXEepheed3Hemie7AhpoiG2cum") .consumer(hardcodedConsumerWithoutCallback) .version(Version.V_1_0_A) .build(); store.put(nonAuthorizedRequestTokenWithoutCallbackForAuthorizing); .tokenSecret("Zijae1XuoT5AYooneingi4NoXiw0uvee") .consumer(hardcodedConsumerWithoutCallback) .version(Version.V_1_0_A) .build(); store.put(nonAuthorizedRequestTokenWithoutCallbackForDenying);