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
31
32
33
/// Specifies how the identity platform should return the requested token to your app.
///
/// Supported values:
///
/// - **query**: Default when requesting an access token. Provides the code as a query string
///     parameter on your redirect URI. The query parameter is not supported when requesting an
///     ID token by using the implicit flow.
/// - fragment: Default when requesting an ID token by using the implicit flow.
///     Also supported if requesting only a code.
/// - form_post: Executes a POST containing the code to your redirect URI.
///     Supported when requesting a code.
#[derive(Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ResponseMode {
    /// Default when requesting an access token. Provides the code as a query string
    /// parameter on your redirect URI. The query parameter is not supported when requesting an
    /// ID token by using the implicit flow.
    #[default]
    Query,
    /// Default when requesting an ID token by using the implicit flow. Also supported if requesting only a code.
    Fragment,
    /// Executes a POST containing the code to your redirect URI. Supported when requesting a code.
    FormPost,
}

impl AsRef<str> for ResponseMode {
    fn as_ref(&self) -> &'static str {
        match self {
            ResponseMode::Query => "query",
            ResponseMode::Fragment => "fragment",
            ResponseMode::FormPost => "form_post",
        }
    }
}