Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/dioxus-axum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use crate::app::App;

#[cfg(not(feature = "server"))]
fn main() {
use shield_bootstrap::dioxus::BootstrapStyle;
use shield_bootstrap::BootstrapDioxusStyle;

dioxus::LaunchBuilder::new()
.with_context(BootstrapStyle::default().context())
.with_context(BootstrapDioxusStyle::default().context())
.launch(App)
}

Expand All @@ -23,8 +23,8 @@ async fn main() {
prelude::{DioxusRouterExt, *},
};
use shield::{Shield, ShieldOptions};
use shield_bootstrap::dioxus::BootstrapStyle;
use shield_dioxus_axum::{DioxusAxumIntegration, ShieldLayer};
use shield_bootstrap::BootstrapDioxusStyle;
use shield_dioxus_axum::{AxumDioxusIntegration, ShieldLayer};
use shield_memory::{MemoryStorage, User};
use shield_oidc::{Keycloak, OidcMethod};
use tokio::net::TcpListener;
Expand Down Expand Up @@ -66,8 +66,8 @@ async fn main() {
let router = Router::new()
.serve_dioxus_application(
ServeConfigBuilder::new()
.context(DioxusAxumIntegration::<User>::default().context())
.context(BootstrapStyle::default().context())
.context(AxumDioxusIntegration::<User>::default().context())
.context(BootstrapDioxusStyle::default().context())
.build()
.unwrap(),
App,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/shield/src/shield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<U: User> Shield<U> {
};

for provider in method.erased_providers().await? {
if !action.erased_condition(&provider, session.clone())? {
if !action.erased_condition(&*provider, session.clone())? {
continue;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/integrations/shield-dioxus-axum/src/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ use shield::{Session, ShieldDyn, User};
use shield_axum::{ExtractSession, ExtractShield};
use shield_dioxus::{DioxusIntegration, DioxusIntegrationDyn};

pub struct DioxusAxumIntegration<U: User>(PhantomData<U>);
pub struct AxumDioxusIntegration<U: User>(PhantomData<U>);

impl<U: User + Clone + 'static> DioxusAxumIntegration<U> {
impl<U: User + Clone + 'static> AxumDioxusIntegration<U> {
pub fn context(self) -> DioxusIntegrationDyn {
DioxusIntegrationDyn::new(self)
}
}

impl<U: User> Default for DioxusAxumIntegration<U> {
impl<U: User> Default for AxumDioxusIntegration<U> {
fn default() -> Self {
Self(Default::default())
}
}

#[async_trait]
impl<U: User + Clone + 'static> DioxusIntegration for DioxusAxumIntegration<U> {
impl<U: User + Clone + 'static> DioxusIntegration for AxumDioxusIntegration<U> {
async fn extract_shield(&self) -> ShieldDyn {
let ExtractShield(shield) = extract::<ExtractShield<U>, _>().await.expect("TODO");

Expand Down
6 changes: 3 additions & 3 deletions packages/styles/shield-bootstrap/src/dioxus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use shield::Form;
use shield_dioxus::{DioxusStyle, ErasedDioxusStyle};

#[derive(Default)]
pub struct BootstrapStyle {}
pub struct BootstrapDioxusStyle {}

impl BootstrapStyle {
impl BootstrapDioxusStyle {
pub fn context(self) -> ErasedDioxusStyle {
ErasedDioxusStyle::new(self)
}
}

impl DioxusStyle for BootstrapStyle {
impl DioxusStyle for BootstrapDioxusStyle {
fn render(&self, forms: &[Form]) -> Element {
rsx! {
div {
Expand Down
5 changes: 4 additions & 1 deletion packages/styles/shield-bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#[cfg(feature = "dioxus")]
pub mod dioxus;
mod dioxus;

#[cfg(feature = "dioxus")]
pub use dioxus::*;