@@ -73,10 +73,34 @@ impl OAuthAuthCodeUrlBuilder {
73
73
self
74
74
}
75
75
76
+ /// Set a generic login hint to help an identity provider pre-fill the login
77
+ /// form.
78
+ ///
79
+ /// Note: This is not the same as the [`Self::user_id_hint()`] method, which
80
+ /// is specifically designed to a) take a `UserId` and no other type of
81
+ /// hint and b) be used directly by MAS and not the identity provider.
82
+ ///
83
+ /// The most likely use case for this method is to pre-fill the login page
84
+ /// using a provisioning link provided by an external party such as
85
+ /// `https://app.example.com/?server_name=example.org&login_hint=alice`
86
+ /// In this instance it is up to the external party to make ensure that the
87
+ /// hint is known to work with their identity provider. For more information
88
+ /// see `login_hint` in <https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest>
89
+ ///
90
+ /// The following methods are mutually exclusive: [`Self::login_hint()`] and
91
+ /// [`Self::user_id_hint()`].
92
+ pub fn login_hint ( mut self , login_hint : String ) -> Self {
93
+ self . login_hint = Some ( login_hint) ;
94
+ self
95
+ }
96
+
76
97
/// Set the hint to the Authorization Server about the Matrix user ID the
77
98
/// End-User might use to log in, as defined in [MSC4198].
78
99
///
79
100
/// [MSC4198]: https://github.com/matrix-org/matrix-spec-proposals/pull/4198
101
+ ///
102
+ /// The following methods are mutually exclusive: [`Self::login_hint()`] and
103
+ /// [`Self::user_id_hint()`].
80
104
pub fn user_id_hint ( mut self , user_id : & UserId ) -> Self {
81
105
self . login_hint = Some ( format ! ( "mxid:{user_id}" ) ) ;
82
106
self
0 commit comments