1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::collections::HashMap;

use josekit::jwk::Jwk;
use reqwest::Method;
use serde_json::Value;

/// # UserinfoRequestParams
/// Parameters for customizing Userinfo request
pub struct UserinfoOptions {
    /// Request method
    pub method: Method,
    /// How to send the access token. Valid values: `header` or `body` (POST request)
    pub via: String,
    /// Additional params to sent with the userinfo request
    pub params: Option<HashMap<String, Value>>,
    /// When provided the client will send a DPoP Proof JWT.
    /// The DPoP Proof JWT's algorithm is determined automatically based on the type of key and the issuer metadata.
    pub dpop: Option<Jwk>,
}

impl Default for UserinfoOptions {
    fn default() -> Self {
        Self {
            method: Method::GET,
            via: "header".to_string(),
            params: None,
            dpop: None,
        }
    }
}