@@ -21,6 +21,7 @@ public static class Revocation
21
21
/*
22
22
* Revocation request preparation:
23
23
*/
24
+ MapNonStandardRequestParameters . Descriptor ,
24
25
OverrideHttpMethod . Descriptor ,
25
26
AttachBearerAccessToken . Descriptor ,
26
27
@@ -30,6 +31,42 @@ public static class Revocation
30
31
NormalizeContentType . Descriptor
31
32
] ) ;
32
33
34
+ /// <summary>
35
+ /// Contains the logic responsible for mapping non-standard request parameters
36
+ /// to their standard equivalent for the providers that require it.
37
+ /// </summary>
38
+ public sealed class MapNonStandardRequestParameters : IOpenIddictClientHandler < PrepareRevocationRequestContext >
39
+ {
40
+ /// <summary>
41
+ /// Gets the default descriptor definition assigned to this handler.
42
+ /// </summary>
43
+ public static OpenIddictClientHandlerDescriptor Descriptor { get ; }
44
+ = OpenIddictClientHandlerDescriptor . CreateBuilder < PrepareRevocationRequestContext > ( )
45
+ . UseSingletonHandler < MapNonStandardRequestParameters > ( )
46
+ . SetOrder ( int . MinValue + 100_000 )
47
+ . SetType ( OpenIddictClientHandlerType . BuiltIn )
48
+ . Build ( ) ;
49
+
50
+ /// <inheritdoc/>
51
+ public ValueTask HandleAsync ( PrepareRevocationRequestContext context )
52
+ {
53
+ if ( context is null )
54
+ {
55
+ throw new ArgumentNullException ( nameof ( context ) ) ;
56
+ }
57
+
58
+ // Yandex doesn't support the standard "token" parameter and requires
59
+ // using the non-standard "access_token" parameter instead.
60
+ if ( context . Registration . ProviderType is ProviderTypes . VkId )
61
+ {
62
+ context . Request . AccessToken = context . Token ;
63
+ context . Request . Token = null ;
64
+ }
65
+
66
+ return default ;
67
+ }
68
+ }
69
+
33
70
/// <summary>
34
71
/// Contains the logic responsible for overriding the HTTP method for the providers that require it.
35
72
/// </summary>
@@ -61,7 +98,6 @@ public ValueTask HandleAsync(PrepareRevocationRequestContext context)
61
98
62
99
request . Method = context . Registration . ProviderType switch
63
100
{
64
-
65
101
ProviderTypes . Zendesk => HttpMethod . Delete ,
66
102
67
103
_ => request . Method
0 commit comments