@@ -104,6 +104,9 @@ public IOAuth2CodeGenerator CodeGenerator
104
104
public async Task < OAuth2AuthorizationCodeResult > GetAuthorizationCodeAsync ( IEnumerable < string > scopes ,
105
105
IOAuth2WebBrowser browser , IDictionary < string , string > extraQueryParams , CancellationToken ct )
106
106
{
107
+ var label = "get auth code" ;
108
+ using IDisposable region = _trace2 . CreateRegion ( OAuth2Constants . Trace2Category , label ) ;
109
+
107
110
string state = CodeGenerator . CreateNonce ( ) ;
108
111
string codeVerifier = CodeGenerator . CreatePkceCodeVerifier ( ) ;
109
112
string codeChallenge = CodeGenerator . CreatePkceCodeChallenge ( OAuth2PkceChallengeMethod . Sha256 , codeVerifier ) ;
@@ -183,6 +186,9 @@ public async Task<OAuth2AuthorizationCodeResult> GetAuthorizationCodeAsync(IEnum
183
186
184
187
public async Task < OAuth2DeviceCodeResult > GetDeviceCodeAsync ( IEnumerable < string > scopes , CancellationToken ct )
185
188
{
189
+ var label = "get device code" ;
190
+ using IDisposable region = _trace2 . CreateRegion ( OAuth2Constants . Trace2Category , label ) ;
191
+
186
192
if ( _endpoints . DeviceAuthorizationEndpoint is null )
187
193
{
188
194
throw new Trace2InvalidOperationException ( _trace2 ,
@@ -218,6 +224,9 @@ public async Task<OAuth2DeviceCodeResult> GetDeviceCodeAsync(IEnumerable<string>
218
224
219
225
public async Task < OAuth2TokenResult > GetTokenByAuthorizationCodeAsync ( OAuth2AuthorizationCodeResult authorizationCodeResult , CancellationToken ct )
220
226
{
227
+ var label = "get token by auth code" ;
228
+ using IDisposable region = _trace2 . CreateRegion ( OAuth2Constants . Trace2Category , label ) ;
229
+
221
230
var formData = new Dictionary < string , string >
222
231
{
223
232
[ OAuth2Constants . TokenEndpoint . GrantTypeParameter ] = OAuth2Constants . TokenEndpoint . AuthorizationCodeGrantType ,
@@ -254,6 +263,9 @@ public async Task<OAuth2TokenResult> GetTokenByAuthorizationCodeAsync(OAuth2Auth
254
263
255
264
public async Task < OAuth2TokenResult > GetTokenByRefreshTokenAsync ( string refreshToken , CancellationToken ct )
256
265
{
266
+ var label = "get token by refresh token" ;
267
+ using IDisposable region = _trace2 . CreateRegion ( OAuth2Constants . Trace2Category , label ) ;
268
+
257
269
var formData = new Dictionary < string , string >
258
270
{
259
271
[ OAuth2Constants . TokenEndpoint . GrantTypeParameter ] = OAuth2Constants . TokenEndpoint . RefreshTokenGrantType ,
@@ -284,6 +296,9 @@ public async Task<OAuth2TokenResult> GetTokenByRefreshTokenAsync(string refreshT
284
296
285
297
public async Task < OAuth2TokenResult > GetTokenByDeviceCodeAsync ( OAuth2DeviceCodeResult deviceCodeResult , CancellationToken ct )
286
298
{
299
+ var label = "get token by device code" ;
300
+ using IDisposable region = _trace2 . CreateRegion ( OAuth2Constants . Trace2Category , label ) ;
301
+
287
302
var formData = new Dictionary < string , string >
288
303
{
289
304
[ OAuth2Constants . DeviceAuthorization . GrantTypeParameter ] = OAuth2Constants . DeviceAuthorization . DeviceCodeGrantType ,
0 commit comments