Example #1
0
        private static async Task TestClientMethods(IManagementApiClient apiClient)
        {
            // Get all clients
            var clients = await apiClient.Clients.GetAllAsync();

            //// Create a new client
            //var newClientRequest = new ClientCreateRequest
            //{
            //    Name = "New test client"
            //};
            //var newClientResponse = await apiClient.Clients.Create(newClientRequest);

            //// Get a single client
            //var client = await apiClient.Clients.Get(newClientResponse.ClientId);

            //// Update the client
            //var updateClientRequest = new ClientUpdateRequest
            //{
            //    Name = "This is an updated name"
            //};
            //var updateClientResponse = await apiClient.Clients.Update(newClientResponse.ClientId, updateClientRequest);

            //// Delete the client
            //await apiClient.Clients.Delete(newClientResponse.ClientId);
        }
Example #2
0
        private static async Task TestConnectionMethods(IManagementApiClient apiClient)
        {
            // Create a new connection
            var newConnectionRequest = new ConnectionCreateRequest
            {
                Name     = "jerrie-new-connection",
                Strategy = "github"
            };
            var newConnection = await apiClient.Connections.CreateAsync(newConnectionRequest);

            // Get a single connection
            var connection = await apiClient.Connections.GetAsync(newConnection.Id);

            // Get all GitHub connections
            var connections = await apiClient.Connections.GetAllAsync("github");

            // Update a connection
            var updateConnectionRequest = new ConnectionUpdateRequest
            {
                Name = "jerrie-updated-connection"
            };

            connection = await apiClient.Connections.UpdateAsync(newConnection.Id, updateConnectionRequest);

            // Delete the connection
            await apiClient.Connections.DeleteAsync(newConnection.Id);
        }
Example #3
0
        private static async Task TestConnectionMethods(IManagementApiClient apiClient)
        {
            // Create a new connection
            var newConnectionRequest = new ConnectionCreateRequest
            {
                Name = "jerrie-new-connection",
                Strategy = "github"
            };
            var newConnection = await apiClient.Connections.CreateAsync(newConnectionRequest);

            // Get a single connection
            var connection = await apiClient.Connections.GetAsync(newConnection.Id);

            // Get all GitHub connections
            var connections = await apiClient.Connections.GetAllAsync("github");

            // Update a connection
            var updateConnectionRequest = new ConnectionUpdateRequest
            {
                Name = "jerrie-updated-connection"
            };
            connection = await apiClient.Connections.UpdateAsync(newConnection.Id, updateConnectionRequest);

            // Delete the connection
            await apiClient.Connections.DeleteAsync(newConnection.Id);
        }
Example #4
0
        private static async Task TestClientMethods(IManagementApiClient apiClient)
        {
            // Get all clients
            var clients = await apiClient.Clients.GetAllAsync();

            //// Create a new client
            //var newClientRequest = new ClientCreateRequest
            //{
            //    Name = "New test client"
            //};
            //var newClientResponse = await apiClient.Clients.Create(newClientRequest);

            //// Get a single client
            //var client = await apiClient.Clients.Get(newClientResponse.ClientId);

            //// Update the client
            //var updateClientRequest = new ClientUpdateRequest
            //{
            //    Name = "This is an updated name"
            //};
            //var updateClientResponse = await apiClient.Clients.Update(newClientResponse.ClientId, updateClientRequest);

            //// Delete the client
            //await apiClient.Clients.Delete(newClientResponse.ClientId);
        }
        public IManagementApiClient GetManagementApiClient()
        {
            IManagementApiClient auth0ManagementApiClient = null;

            Task.Run(async() =>
            {
                auth0ManagementApiClient = await GetManagementApiClientAsync();
            }).Wait();

            return(auth0ManagementApiClient);
        }
Example #6
0
        public async Task InitializeAsync()
        {
            string token = await GenerateManagementApiToken();

            _managementApiClient = new ManagementApiClient(token, GetVariable("AUTH0_MANAGEMENT_API_URL"));
        }
Example #7
0
 public HomeController(ILogger <HomeController> logger, IManagementApiClient httpCient)
 {
     _logger     = logger;
     _httpClient = httpCient;
 }
Example #8
0
 public ManagementController(IManagementApiClient managementApiClient)
 {
     _managementApiClient = managementApiClient;
 }