-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIdentityClient.cs
32 lines (25 loc) · 936 Bytes
/
IdentityClient.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Grpc.Net.Client;
namespace Identity.Client;
public class IdentityClient : IDisposable
{
readonly GrpcChannel channel;
readonly Auth.AuthClient client;
public IdentityClient(string address)
{
channel = GrpcChannel.ForAddress(address);
client = new Auth.AuthClient(channel);
}
public async Task<UserList> GetDomainUsers() =>
await client.GetDomainUsersAsync(new Empty());
public async Task<UserList> FindDomainUsers(string search) =>
await client.FindDomainUsersAsync(new String { Value = search });
public async Task<User> GetUser(string samAccountName) =>
await client.GetUserAsync(new String { Value = samAccountName });
public async Task<User> GetUserByGuid(string guid) =>
await client.GetUserByGuidAsync(new String { Value = guid });
public void Dispose()
{
channel.Dispose();
GC.SuppressFinalize(this);
}
}