pub struct DeviceGrant<S: AuthSchema> { /* private fields */ }Expand description
Request authorization and session redemption policy for one Device plugin.
Implementations§
Source§impl<S: AuthSchema> DeviceGrant<S>
impl<S: AuthSchema> DeviceGrant<S>
Sourcepub fn new<A, R>(authorize_request: A, assert_session_redemption: R) -> Selfwhere
A: for<'a> Fn(&'a DeviceAuthorizationRequest, &'a EndpointContext<'_, S>) -> DeviceGrantFuture<'a, Option<DeviceGrantAuthorization>> + Send + Sync + 'static,
R: for<'a> Fn(&'a DeviceCode, &'a EndpointContext<'_, S>) -> DeviceGrantFuture<'a, ()> + Send + Sync + 'static,
pub fn new<A, R>(authorize_request: A, assert_session_redemption: R) -> Selfwhere
A: for<'a> Fn(&'a DeviceAuthorizationRequest, &'a EndpointContext<'_, S>) -> DeviceGrantFuture<'a, Option<DeviceGrantAuthorization>> + Send + Sync + 'static,
R: for<'a> Fn(&'a DeviceCode, &'a EndpointContext<'_, S>) -> DeviceGrantFuture<'a, ()> + Send + Sync + 'static,
Require both request authorization and a session redemption policy.
Authorization returning None uses the configured client validator.
The session policy runs after the stored client check and before redemption state changes.
Sourcepub fn stored_fields(self, fields: UserConfig) -> Self
pub fn stored_fields(self, fields: UserConfig) -> Self
Register declared grant fields through the existing adapter field policies.
Sourcepub fn request_error_codes(self, codes: Vec<String>) -> Self
pub fn request_error_codes(self, codes: Vec<String>) -> Self
Append documented request error codes in order, retaining duplicate values.
Sourcepub fn request_openapi_responses(self, responses: Map<String, Value>) -> Self
pub fn request_openapi_responses(self, responses: Map<String, Value>) -> Self
Document additional request responses. The fixed 200, 400, and 500 responses take precedence.
Sourcepub fn verification_openapi_properties(
self,
properties: Map<String, Value>,
) -> Self
pub fn verification_openapi_properties( self, properties: Map<String, Value>, ) -> Self
Document verification display properties. Initialization rejects native property names.
Sourcepub fn verification_context(
self,
callback: impl Fn(&DeviceCode) -> AuthResult<Option<Map<String, Value>>> + Send + Sync + 'static,
) -> Self
pub fn verification_context( self, callback: impl Fn(&DeviceCode) -> AuthResult<Option<Map<String, Value>>> + Send + Sync + 'static, ) -> Self
Add display data only when the current session owns the verification request. Native response fields retain precedence, including their omission.