Skip to content

Commit

Permalink
feat: make setters nicer to use
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-shine authored and ctron committed Jan 26, 2024
1 parent cdd734d commit 72037dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,23 @@ pub mod openid {
}

/// Set an override for the URL for ending the session.
pub fn with_end_session_url(mut self, end_session_url: impl Into<Option<String>>) -> Self {
self.end_session_url = end_session_url.into();
pub fn with_end_session_url(mut self, end_session_url: impl Into<String>) -> Self {
self.end_session_url = Some(end_session_url.into());
self
}

/// Set the URL the issuer should redirect to after the logout
pub fn with_after_logout_url(
mut self,
after_logout_url: impl Into<Option<String>>,
) -> Self {
self.after_logout_url = after_logout_url.into();
pub fn with_after_logout_url(mut self, after_logout_url: impl Into<String>) -> Self {
self.after_logout_url = Some(after_logout_url.into());
self
}

/// Set the name of the post logout redirect query parameter
pub fn with_post_logout_redirect_name(
mut self,
post_logout_redirect_name: impl Into<Option<String>>,
post_logout_redirect_name: impl Into<String>,
) -> Self {
self.post_logout_redirect_name = post_logout_redirect_name.into();
self.post_logout_redirect_name = Some(post_logout_redirect_name.into());
self
}

Expand Down
2 changes: 1 addition & 1 deletion yew-oauth2-redirect-example/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn app() -> Html {
back to the current page, which is detected as a new session, and will try to log in
again, if the page requires this.
*/
.with_after_logout_url(Some("/".into()));
.with_after_logout_url("/");

let mode = if cfg!(feature = "openid") {
"OpenID Connect"
Expand Down

0 comments on commit 72037dc

Please sign in to comment.