.twoLOAllowed(twoLOAllowed).executingTwoLOUser(executingTwoLOUser).twoLOImpersonationAllowed(twoLOImpersonationAllowed) .build(); providerStoreService.addConsumer(consumer, applicationLink);
.twoLOAllowed(twoLoEnabled) .executingTwoLOUser(twoLoEnabled ? executeAsUser : null) .twoLOImpersonationAllowed(twoLoIEnabled) .build();
.callback(new URI("http://callback.com")) .twoLOAllowed(options.add2LO) .executingTwoLOUser("2LOuser") .twoLOImpersonationAllowed(options.add2LOi) .build();
.description("Hardcoded 2LO Consumer") .twoLOAllowed(true) .executingTwoLOUser("barney") .build(); consumerStore.put(hardcoded2LOConsumer); .threeLOAllowed(false) .twoLOAllowed(true) .executingTwoLOUser("barney") .build(); consumerStore.put(hardcoded2LOOnlyConsumer); .description("Hardcoded 2LO Consumer with bad executing user") .twoLOAllowed(true) .executingTwoLOUser("does_not_exist_user") .build(); consumerStore.put(hardcoded2LOConsumerBadExecutingUser); .description("Hardcoded 2LO Consumer with bad executing user") .twoLOAllowed(true) .executingTwoLOUser(null) .build(); consumerStore.put(hardcoded2LOConsumerNullExecutingUser); .description("Hardcoded 2LO with Impersonation Consumer") .twoLOAllowed(true) .executingTwoLOUser("barney") .twoLOImpersonationAllowed(true) .build();
.callback(consumer.getCallback()) .twoLOAllowed(consumerEntity.isTwoLOAllowed()) .executingTwoLOUser(consumerEntity.getExecutingTwoLOUser()) .twoLOImpersonationAllowed(consumerEntity.isTwoLOImpersonationAllowed()) .build(); .callback(consumer.getCallback()) .twoLOAllowed(consumerEntity.isTwoLOAllowed()) .executingTwoLOUser(consumerEntity.getExecutingTwoLOUser()) .twoLOImpersonationAllowed(consumerEntity.isTwoLOImpersonationAllowed()) .build();
.callback(URI.create(appProp.getBaseUrl() + "/consumer/oauthcallback1")) .twoLOAllowed(true) .executingTwoLOUser("2lo_user") .twoLOImpersonationAllowed(true) .build(); .callback(URI.create(appProp.getBaseUrl() + "/consumer/oauthcallback1")) .twoLOAllowed(false) .executingTwoLOUser("2lo_user_changed") .twoLOImpersonationAllowed(false) .build();
@Test public void testServiceProviderConsumerStoreCanStoreOAuth2LOConfiguration() throws Exception { PublicKey publicKey = RSAKeys.fromPemEncodingToPublicKey(CONSUMER_PUBLIC_KEY); final Consumer consumer = Consumer.key(CONSUMER_KEY) .name("Test Consumer Name") .publicKey(publicKey) .description("Consumer Description") .callback(URI.create(appProp.getBaseUrl() + "/consumer/oauthcallback1")) .twoLOAllowed(true) .executingTwoLOUser("2lo_user") .build(); consumerStore.put(consumer); final Consumer savedConsumer = consumerStore.get(CONSUMER_KEY); assertTrue(savedConsumer.getTwoLOAllowed()); assertEquals("2lo_user", savedConsumer.getExecutingTwoLOUser()); }
public static Consumer.InstanceBuilder consumerBuilder(@Nonnull Consumer consumer) { checkNotNull(consumer, "consumer"); Consumer.InstanceBuilder builder = new Consumer.InstanceBuilder(consumer.getKey()) .name(consumer.getName()) .description(consumer.getDescription()) .signatureMethod(consumer.getSignatureMethod()) .callback(consumer.getCallback()) .twoLOAllowed(consumer.getTwoLOAllowed()) .executingTwoLOUser(consumer.getExecutingTwoLOUser()) .twoLOImpersonationAllowed(consumer.getTwoLOImpersonationAllowed()); if (consumer.getPublicKey() != null) { builder.publicKey(consumer.getPublicKey()); } return builder; } }
private void setUpOAuthConsumer() throws Exception { PublicKey publicKey = RSAKeys.fromPemEncodingToPublicKey(CONSUMER_PUBLIC_KEY); Consumer hardcodedConsumer = Consumer.key("hardcoded-consumer") .name("Hardcoded Consumer") .publicKey(publicKey) .description("Hardcoded Consumer") .callback(URI.create(appProp.getBaseUrl() + "/consumer/oauthcallback")) .twoLOAllowed(true) .executingTwoLOUser(infoProvider.getAdminUsername()) .build(); consumerStore.put(hardcodedConsumer); }