@@ -216,6 +216,45 @@ impl std::str::FromStr for TokenAuthMethod {
216216#[ error( "Invalid upstream OAuth 2.0 token auth method: {0}" ) ]
217217pub struct InvalidUpstreamOAuth2TokenAuthMethod ( String ) ;
218218
219+ #[ derive( Debug , Clone , Copy , Serialize , Deserialize , PartialEq , Eq ) ]
220+ #[ serde( rename_all = "snake_case" ) ]
221+ pub enum OnBackchannelLogout {
222+ DoNothing ,
223+ LogoutBrowserOnly ,
224+ }
225+
226+ impl OnBackchannelLogout {
227+ #[ must_use]
228+ pub fn as_str ( self ) -> & ' static str {
229+ match self {
230+ Self :: DoNothing => "do_nothing" ,
231+ Self :: LogoutBrowserOnly => "logout_browser_only" ,
232+ }
233+ }
234+ }
235+
236+ impl std:: fmt:: Display for OnBackchannelLogout {
237+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
238+ f. write_str ( self . as_str ( ) )
239+ }
240+ }
241+
242+ impl std:: str:: FromStr for OnBackchannelLogout {
243+ type Err = InvalidUpstreamOAuth2OnBackchannelLogout ;
244+
245+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
246+ match s {
247+ "do_nothing" => Ok ( Self :: DoNothing ) ,
248+ "logout_browser_only" => Ok ( Self :: LogoutBrowserOnly ) ,
249+ s => Err ( InvalidUpstreamOAuth2OnBackchannelLogout ( s. to_owned ( ) ) ) ,
250+ }
251+ }
252+ }
253+
254+ #[ derive( Debug , Clone , Error ) ]
255+ #[ error( "Invalid upstream OAuth 2.0 'on backchannel logout': {0}" ) ]
256+ pub struct InvalidUpstreamOAuth2OnBackchannelLogout ( String ) ;
257+
219258#[ derive( Debug , Clone , PartialEq , Eq , Serialize ) ]
220259pub struct UpstreamOAuthProvider {
221260 pub id : Ulid ,
@@ -242,6 +281,7 @@ pub struct UpstreamOAuthProvider {
242281 pub claims_imports : ClaimsImports ,
243282 pub additional_authorization_parameters : Vec < ( String , String ) > ,
244283 pub forward_login_hint : bool ,
284+ pub on_backchannel_logout : OnBackchannelLogout ,
245285}
246286
247287impl PartialOrd for UpstreamOAuthProvider {
0 commit comments