Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Apr 18, 2024
1 parent 883f58a commit bdba837
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 39 deletions.
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yew-oauth2"
version = "0.10.2"
version = "0.11.0-alpha.1"
authors = ["Jens Reimann <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand All @@ -20,7 +20,7 @@ js-sys = "0.3"
log = "0.4"
num-traits = "0.2"
oauth2 = "4"
reqwest = "0.11"
reqwest = "0.12"
serde = { version = "1", features = ["derive"] }
time = { version = "0.3", features = ["wasm-bindgen"] }
tokio = { version = "1", features = ["sync"] }
Expand All @@ -33,11 +33,9 @@ web-sys = { version = "0.3", features = [
] }

openidconnect = { version = "3.0", optional = true }
yew-nested-router = { version = "0.6.3", optional = true }
yew-nested-router = { version = "0.7.0-alpha.1", optional = true }

[features]
# Enable for Yew nested router support
nested-router = ["yew-nested-router"]
# Enable for OpenID Connect support
openid = ["openidconnect"]

Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Add to your `Cargo.toml`:
yew-oauth2 = "0.10"
```

By default, the `nested-router` integration for [`yew-nested-router`](https://github.com/ctron/yew-nested-router) is disabled,
you can enable it using:
By default, the `yew-nested-router` integration for [`yew-nested-router`](https://github.com/ctron/yew-nested-router) is
disabled. You can enable it using:

```toml
yew-oauth2 = { version = "0.10", features = ["nested-router"] }
yew-oauth2 = { version = "0.10", features = ["yew-nested-router"] }
```

## OpenID Connect
Expand All @@ -23,7 +23,7 @@ OpenID Connect requires an additional dependency and can be enabled using the fe

## Examples

A quick example how to use it (see below for more complete examples):
A quick example of how to use it (see below for more complete examples):

```rust
use yew::prelude::*;
Expand All @@ -32,13 +32,13 @@ use yew_oauth2::oauth2::*; // use `openid::*` when using OpenID connect

#[function_component(MyApplication)]
fn my_app() -> Html {
let config = Config::new(
"my-client",
"https://my-sso/auth/realms/my-realm/protocol/openid-connect/auth",
"https://my-sso/auth/realms/my-realm/protocol/openid-connect/token"
);
let config = Config::new(
"my-client",
"https://my-sso/auth/realms/my-realm/protocol/openid-connect/auth",
"https://my-sso/auth/realms/my-realm/protocol/openid-connect/token"
);

html!(
html!(
<OAuth2 {config}>
<MyApplicationMain/>
</OAuth2>
Expand All @@ -47,16 +47,16 @@ fn my_app() -> Html {

#[function_component(MyApplicationMain)]
fn my_app_main() -> Html {
let agent = use_auth_agent().expect("Must be nested inside an OAuth2 component");
let agent = use_auth_agent().expect("Must be nested inside an OAuth2 component");

let login = use_callback(agent.clone(), |_, agent| {
let _ = agent.start_login();
});
let logout = use_callback(agent, |_, agent| {
let _ = agent.logout();
});
let login = use_callback(agent.clone(), |_, agent| {
let _ = agent.start_login();
});
let logout = use_callback(agent, |_, agent| {
let _ = agent.logout();
});

html!(
html!(
<>
<Failure><FailureMessage/></Failure>
<Authenticated>
Expand Down
6 changes: 3 additions & 3 deletions yew-oauth2-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ humantime = "2"
log = { version = "0.4", features = [] }
serde_json = "1"
time = "0.3"
wasm-bindgen = "0.2.79"
wasm-bindgen = "0.2.92"
wasm-logger = "0.2"
yew = { version = "0.21", features = ["csr"] }
yew-nested-router = "0.6.1"
yew = { version = "0.21.0", features = ["csr"] }
yew-nested-router = "0.7.0-alpha.1"

openidconnect = { version = "3.0", optional = true }

Expand Down
12 changes: 6 additions & 6 deletions yew-oauth2-example/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn content() -> Html {

#[cfg(feature = "openid")]
let openid_routes = html! (
<li><Link<AppRoute> target={AppRoute::Identity}> { "Identity" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Identity}> { "Identity" } </Link<AppRoute>></li>
);
#[cfg(not(feature = "openid"))]
let openid_routes = html!();
Expand All @@ -58,11 +58,11 @@ pub fn content() -> Html {
<button onclick={logout}>{ "Logout" }</button>
</p>
<ul>
<li><Link<AppRoute> target={AppRoute::Index}> { "Index" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::Component}> { "Component" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::Function}> { "Function" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::UseAuthentication}> { "Use" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::UseLatestToken}> { "Latest Token" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Index}> { "Index" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Component}> { "Component" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Function}> { "Function" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::UseAuthentication}> { "Use" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::UseLatestToken}> { "Latest Token" } </Link<AppRoute>></li>
{ openid_routes }
</ul>
<Expiration/>
Expand Down
5 changes: 3 additions & 2 deletions yew-oauth2-redirect-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ edition = "2021"

[dependencies]
yew-oauth2 = { path = "..", features = ["yew-nested-router"] }

gloo-timers = "0.3"
humantime = "2"
log = { version = "0.4", features = [] }
serde_json = "1"
time = "0.3"
wasm-bindgen = "0.2.79"
wasm-bindgen = "0.2.92"
wasm-logger = "0.2"
yew = { version = "0.21.0", features = ["csr"] }
yew-nested-router = "0.6.1"
yew-nested-router = "0.7.0-alpha.1"

openidconnect = { version = "3.0", optional = true }

Expand Down
10 changes: 5 additions & 5 deletions yew-oauth2-redirect-example/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ pub fn content() -> Html {

/* We show the full menu structure here */
<ul>
<li><Link<AppRoute> target={AppRoute::Index}> { "Public" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::Authenticated(AuthenticatedRoute::Index)}> { "Authenticated" } </Link<AppRoute>>
<li><Link<AppRoute> to={AppRoute::Index}> { "Public" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Authenticated(AuthenticatedRoute::Index)}> { "Authenticated" } </Link<AppRoute>>
<ul>
<li><Link<AppRoute> target={AppRoute::Authenticated(AuthenticatedRoute::Component)}> { "Component" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::Authenticated(AuthenticatedRoute::Function)}> { "Function" } </Link<AppRoute>></li>
<li><Link<AppRoute> target={AppRoute::Authenticated(AuthenticatedRoute::UseAuthentication)}> { "Use" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Authenticated(AuthenticatedRoute::Component)}> { "Component" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Authenticated(AuthenticatedRoute::Function)}> { "Function" } </Link<AppRoute>></li>
<li><Link<AppRoute> to={AppRoute::Authenticated(AuthenticatedRoute::UseAuthentication)}> { "Use" } </Link<AppRoute>></li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit bdba837

Please sign in to comment.