@@ -54,7 +54,6 @@ public static partial class OpenIddictClientWebIntegrationHandlers
54
54
* Revocation processing:
55
55
*/
56
56
OverrideRevocationEndpointClientAuthenticationMethod . Descriptor ,
57
- AttachAdditionalRevocationRequestParameters . Descriptor ,
58
57
AttachNonStandardRevocationClientAssertionClaims . Descriptor ,
59
58
AttachRevocationRequestNonStandardClientCredentials . Descriptor ,
60
59
@@ -1962,6 +1961,27 @@ public ValueTask HandleAsync(ProcessChallengeContext context)
1962
1961
context . Request [ "language" ] = settings . Language ;
1963
1962
}
1964
1963
1964
+ // Yandex allows sending optional "device_id" and "device_name" parameters.
1965
+ else if ( context . Registration . ProviderType is ProviderTypes . Yandex )
1966
+ {
1967
+ var settings = context . Registration . GetYandexSettings ( ) ;
1968
+
1969
+ if ( ! context . Properties . TryGetValue ( Yandex . Properties . DeviceId , out string ? identifier ) ||
1970
+ string . IsNullOrEmpty ( identifier ) )
1971
+ {
1972
+ identifier = settings . DeviceId ;
1973
+ }
1974
+
1975
+ if ( ! context . Properties . TryGetValue ( Yandex . Properties . DeviceName , out string ? name ) ||
1976
+ string . IsNullOrEmpty ( name ) )
1977
+ {
1978
+ name = settings . DeviceName ;
1979
+ }
1980
+
1981
+ context . Request [ "device_id" ] = identifier ;
1982
+ context . Request [ "device_name" ] = name ;
1983
+ }
1984
+
1965
1985
// By default, Zoho doesn't return a refresh token but
1966
1986
// allows sending an "access_type" parameter to retrieve one.
1967
1987
else if ( context . Registration . ProviderType is ProviderTypes . Zoho )
@@ -2014,49 +2034,6 @@ public ValueTask HandleAsync(ProcessRevocationContext context)
2014
2034
}
2015
2035
}
2016
2036
2017
- /// <summary>
2018
- /// Contains the logic responsible for attaching additional parameters
2019
- /// to the revocation request for the providers that require it.
2020
- /// </summary>
2021
- public sealed class AttachAdditionalRevocationRequestParameters : IOpenIddictClientHandler < ProcessRevocationContext >
2022
- {
2023
- /// <summary>
2024
- /// Gets the default descriptor definition assigned to this handler.
2025
- /// </summary>
2026
- public static OpenIddictClientHandlerDescriptor Descriptor { get ; }
2027
- = OpenIddictClientHandlerDescriptor . CreateBuilder < ProcessRevocationContext > ( )
2028
- . UseSingletonHandler < AttachAdditionalRevocationRequestParameters > ( )
2029
- . SetOrder ( AttachRevocationRequestParameters . Descriptor . Order + 500 )
2030
- . SetType ( OpenIddictClientHandlerType . BuiltIn )
2031
- . Build ( ) ;
2032
-
2033
- /// <inheritdoc/>
2034
- public ValueTask HandleAsync ( ProcessRevocationContext context )
2035
- {
2036
- if ( context is null )
2037
- {
2038
- throw new ArgumentNullException ( nameof ( context ) ) ;
2039
- }
2040
-
2041
- Debug . Assert ( context . RevocationRequest is not null , SR . GetResourceString ( SR . ID4008 ) ) ;
2042
-
2043
- // Yandex requires attaching a non-standard "device_id" parameter to revocation requests.
2044
- // This parameter must be manually provided by the application via an authentication property.
2045
- if ( context . Registration . ProviderType is ProviderTypes . Yandex )
2046
- {
2047
- if ( ! context . Properties . TryGetValue ( VkId . Properties . DeviceId , out string ? identifier ) ||
2048
- string . IsNullOrEmpty ( identifier ) )
2049
- {
2050
- throw new InvalidOperationException ( SR . GetResourceString ( SR . ID0467 ) ) ;
2051
- }
2052
-
2053
- context . RevocationRequest [ "device_id" ] = identifier ;
2054
- }
2055
-
2056
- return default ;
2057
- }
2058
- }
2059
-
2060
2037
/// <summary>
2061
2038
/// Contains the logic responsible for adding non-standard claims to the client
2062
2039
/// assertions used for the revocation endpoint for the providers that require it.
0 commit comments