Skip to content

Commit 1688b5a

Browse files
authored
ClientCollection builder methods returns with client (#13437)
1 parent 5db8951 commit 1688b5a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientCollection.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,41 @@ public void AddRange(params Client[] clients)
6868
/// </summary>
6969
/// <param name="clientId">The client id for the single page application.</param>
7070
/// <param name="configure">The <see cref="Action{ClientBuilder}"/> to configure the default single page application.</param>
71-
public void AddIdentityServerSPA(string clientId, Action<ClientBuilder> configure)
71+
public Client AddIdentityServerSPA(string clientId, Action<ClientBuilder> configure)
7272
{
7373
var app = ClientBuilder.IdentityServerSPA(clientId);
7474
configure(app);
75-
Add(app.Build());
75+
var client = app.Build();
76+
Add(client);
77+
return client;
7678
}
7779

7880
/// <summary>
7981
/// Adds an externally registered single page application.
8082
/// </summary>
8183
/// <param name="clientId">The client id for the single page application.</param>
8284
/// <param name="configure">The <see cref="Action{ClientBuilder}"/> to configure the default single page application.</param>
83-
public void AddSPA(string clientId, Action<ClientBuilder> configure)
85+
public Client AddSPA(string clientId, Action<ClientBuilder> configure)
8486
{
8587
var app = ClientBuilder.SPA(clientId);
8688
configure(app);
87-
Add(app.Build());
89+
var client = app.Build();
90+
Add(client);
91+
return client;
8892
}
8993

9094
/// <summary>
9195
/// Adds an externally registered native application..
9296
/// </summary>
9397
/// <param name="clientId">The client id for the single page application.</param>
9498
/// <param name="configure">The <see cref="Action{ClientBuilder}"/> to configure the native application.</param>
95-
public void AddNativeApp(string clientId, Action<ClientBuilder> configure)
99+
public Client AddNativeApp(string clientId, Action<ClientBuilder> configure)
96100
{
97101
var app = ClientBuilder.NativeApp(clientId);
98102
configure(app);
99-
Add(app.Build());
103+
var client = app.Build();
104+
Add(client);
105+
return client;
100106
}
101107
}
102108
}

0 commit comments

Comments
 (0)