/*
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* See https://github.com/openiddict/openiddict-core for more information concerning
* the license and the contributors participating to this project.
*/
namespace OpenIddict.Client;
public static partial class OpenIddictClientEvents
{
///
/// Represents an event called for each request to the device authorization endpoint
/// to give the user code a chance to add parameters to the device authorization request.
///
public sealed class PrepareDeviceAuthorizationRequestContext : BaseExternalContext
{
///
/// Creates a new instance of the class.
///
public PrepareDeviceAuthorizationRequestContext(OpenIddictClientTransaction transaction)
: base(transaction)
{
}
///
/// Gets or sets the request.
///
public OpenIddictRequest Request
{
get => Transaction.Request!;
set => Transaction.Request = value;
}
}
///
/// Represents an event called for each request to the device authorization endpoint
/// to send the device authorization request to the remote authorization server.
///
public sealed class ApplyDeviceAuthorizationRequestContext : BaseExternalContext
{
///
/// Creates a new instance of the class.
///
public ApplyDeviceAuthorizationRequestContext(OpenIddictClientTransaction transaction)
: base(transaction)
{
}
///
/// Gets or sets the request.
///
public OpenIddictRequest Request
{
get => Transaction.Request!;
set => Transaction.Request = value;
}
}
///
/// Represents an event called for each device authorization response
/// to extract the response parameters from the server response.
///
public sealed class ExtractDeviceAuthorizationResponseContext : BaseExternalContext
{
///
/// Creates a new instance of the class.
///
public ExtractDeviceAuthorizationResponseContext(OpenIddictClientTransaction transaction)
: base(transaction)
{
}
///
/// Gets or sets the request.
///
public OpenIddictRequest Request
{
get => Transaction.Request!;
set => Transaction.Request = value;
}
///
/// Gets or sets the response, or if it wasn't extracted yet.
///
public OpenIddictResponse? Response
{
get => Transaction.Response;
set => Transaction.Response = value;
}
}
///
/// Represents an event called for each device authorization response.
///
public sealed class HandleDeviceAuthorizationResponseContext : BaseExternalContext
{
///
/// Creates a new instance of the class.
///
public HandleDeviceAuthorizationResponseContext(OpenIddictClientTransaction transaction)
: base(transaction)
{
}
///
/// Gets or sets the request.
///
public OpenIddictRequest Request
{
get => Transaction.Request!;
set => Transaction.Request = value;
}
///
/// Gets or sets the response.
///
public OpenIddictResponse Response
{
get => Transaction.Response!;
set => Transaction.Response = value;
}
}
}