protected override void ProcessRecord() { using (var identityClient = new EryphIdentityClient(GetCredentials("identity:clients:read:all"))) { if (Id != null) { foreach (var id in Id) { WriteObject(identityClient.Clients.Get(id)); } return; } if (Name != null) { foreach (var name in Name) { WriteObject(identityClient.Clients.List(), true); } return; } WriteObject(identityClient.Clients.List(), true); } }
protected override void ProcessRecord() { using (var identityClient = new EryphIdentityClient(GetCredentials("identity:clients:write:all"))) { foreach (var id in Id) { identityClient.Clients.Delete(id); } } }
protected override void ProcessRecord() { using (var identityClient = new EryphIdentityClient(GetCredentials("identity:clients:write:all"))) { foreach (var id in Id) { WriteObject(identityClient.Clients.UpdateWithHttpMessagesAsync(id, new Client(null, Name, Description, AllowedScopes)).GetAwaiter().GetResult().Body); } } }
protected override void ProcessRecord() { var clientCredentials = GetClientCredentials(); using (var identityClient = new EryphIdentityClient(GetCredentials("identity:clients:write:all"))) { foreach (var name in Name) { var result = identityClient.Clients.Create(new Client { Name = name, Description = Description, AllowedScopes = AllowedScopes }); if (AddToConfiguration) { var asDefault = !AsDefault ? "" : " -AsDefault"; InvokeCommand.InvokeScript( $@"$args[0] | New-EryphClientCredentials -Id ""{result.Id}"" -IdentityEndpoint ""{clientCredentials.IdentityProvider}"" -Configuration ""{clientCredentials.Configuration}"" | Add-EryphClientConfiguration -Name ""{result.Name}""{asDefault}", result.Key); WriteObject(new Client(result.Id, result.Name, result.Description, result.AllowedScopes)); } else { WriteObject(new CreatedClient { Id = result.Id, Name = result.Name, AllowedScopes = result.AllowedScopes.ToArray(), Description = result.Description, IdentityProvider = clientCredentials.IdentityProvider, PrivateKey = result.Key }); } } } }