Added the partner consent sample and restructured the repository. (#4)
This commit is contained in:
Родитель
a33f660bb3
Коммит
b8a1c80219
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.store.partnercenter.samples;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -16,6 +16,7 @@ import java.util.concurrent.Future;
|
|||
|
||||
import com.microsoft.aad.adal4j.AuthenticationContext;
|
||||
import com.microsoft.aad.adal4j.AuthenticationResult;
|
||||
import com.microsoft.aad.adal4j.DeviceCode;
|
||||
import com.microsoft.store.partnercenter.AuthenticationToken;
|
||||
import com.microsoft.store.partnercenter.IAadLoginHandler;
|
||||
import com.microsoft.store.partnercenter.samples.configuration.ConfigurationHolder;
|
||||
|
@ -42,29 +43,34 @@ public class AadUserLoginHandler
|
|||
ConfigurationHolder.getInstance().getConfiguration().getUserAuthentication().get( "ResourceUrl" );
|
||||
String clientId =
|
||||
ConfigurationHolder.getInstance().getConfiguration().getUserAuthentication().get( "ClientId" );
|
||||
String userName =
|
||||
ConfigurationHolder.getInstance().getConfiguration().getUserAuthentication().get( "UserName" );
|
||||
String password =
|
||||
ConfigurationHolder.getInstance().getConfiguration().getUserAuthentication().get( "Password" );
|
||||
|
||||
AuthenticationContext context = null;
|
||||
AuthenticationResult result = null;
|
||||
ExecutorService service = null;
|
||||
|
||||
try
|
||||
{
|
||||
URI addAuthority = new URI( authority ).resolve( new URI( commonDomain ) );
|
||||
|
||||
service = Executors.newFixedThreadPool( 1 );
|
||||
context = new AuthenticationContext( addAuthority.toString(), false, service );
|
||||
Future<AuthenticationResult> future =
|
||||
context.acquireToken( resourceUrl, clientId, userName, password, null );
|
||||
|
||||
Future<DeviceCode> deviceCodeResult = context.acquireDeviceCode(clientId, resourceUrl, null);
|
||||
DeviceCode deviceCode = deviceCodeResult.get();
|
||||
|
||||
System.out.println(deviceCode.getMessage());
|
||||
System.out.println("After you have successfully authenticating press enter to continue...");
|
||||
System.in.read();
|
||||
|
||||
Future<AuthenticationResult> future = context.acquireTokenByDeviceCode(deviceCode, null);
|
||||
|
||||
result = future.get();
|
||||
}
|
||||
catch ( URISyntaxException e )
|
||||
catch(IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch ( MalformedURLException e )
|
||||
catch ( URISyntaxException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
|
@ -140,6 +140,7 @@ import com.microsoft.store.partnercenter.samples.subscriptions.AddSubscriptionAd
|
|||
import com.microsoft.store.partnercenter.samples.subscriptions.GetSubscription;
|
||||
import com.microsoft.store.partnercenter.samples.subscriptions.GetSubscriptions;
|
||||
import com.microsoft.store.partnercenter.samples.subscriptions.GetSubscriptionsByOrder;
|
||||
import com.microsoft.store.partnercenter.samples.subscriptions.RegisterSubscription;
|
||||
import com.microsoft.store.partnercenter.samples.subscriptions.UpdateSubscription;
|
||||
import com.microsoft.store.partnercenter.samples.subscriptions.UpgradeSubscription;
|
||||
import com.microsoft.store.partnercenter.samples.utilization.GetAzureSubscriptionUtilization;
|
||||
|
@ -187,7 +188,7 @@ public class Program
|
|||
mainScenarios.add(Program.getEntitlementScenarios(context));
|
||||
|
||||
// run the main scenario
|
||||
new AggregatePartnerScenario( "Partner SDK samples", mainScenarios, context ).run();
|
||||
new AggregatePartnerScenario( "Partner Center Java SDK samples", mainScenarios, context ).run();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,10 +200,13 @@ public class Program
|
|||
private static IPartnerScenario getCustomerScenarios( IScenarioContext context )
|
||||
{
|
||||
List<IPartnerScenario> customerFilteringScenarios = new ArrayList<IPartnerScenario>();
|
||||
customerFilteringScenarios.add( new FilterCustomers( "Filter by company name", CustomerSearchField.COMPANY_NAME,
|
||||
context ) );
|
||||
customerFilteringScenarios.add( new FilterCustomers( "Filter by domain name", CustomerSearchField.DOMAIN_NAME,
|
||||
context ) );
|
||||
customerFilteringScenarios.add( new FilterCustomers(
|
||||
"Filter by company name", CustomerSearchField.COMPANY_NAME,
|
||||
context ) );
|
||||
customerFilteringScenarios.add(
|
||||
new FilterCustomers( "Filter by domain name", CustomerSearchField.DOMAIN_NAME,
|
||||
context ) );
|
||||
|
||||
List<IPartnerScenario> customerScenarios = new ArrayList<IPartnerScenario>();
|
||||
|
||||
customerScenarios.add( new CreateCustomer( context ) );
|
||||
|
@ -273,12 +277,13 @@ public class Program
|
|||
{
|
||||
List<IPartnerScenario> subscriptionScenarios = new ArrayList<IPartnerScenario>();
|
||||
|
||||
subscriptionScenarios.add( new GetSubscription( context ) );
|
||||
subscriptionScenarios.add( new GetSubscriptions( context ) );
|
||||
subscriptionScenarios.add( new GetSubscriptionsByOrder( context ) );
|
||||
subscriptionScenarios.add( new UpdateSubscription( context ) );
|
||||
subscriptionScenarios.add( new UpgradeSubscription( context ) );
|
||||
subscriptionScenarios.add( new AddSubscriptionAddOn( context ) );
|
||||
subscriptionScenarios.add(new GetSubscription(context));
|
||||
subscriptionScenarios.add(new GetSubscriptions(context));
|
||||
subscriptionScenarios.add(new GetSubscriptionsByOrder(context));
|
||||
subscriptionScenarios.add(new UpdateSubscription(context));
|
||||
subscriptionScenarios.add(new UpgradeSubscription(context));
|
||||
subscriptionScenarios.add(new AddSubscriptionAddOn(context));
|
||||
subscriptionScenarios.add(new RegisterSubscription(context));
|
||||
|
||||
return new AggregatePartnerScenario( "Subscription samples", subscriptionScenarios, context );
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче