Skip to content

Commit 2539c83

Browse files
feat(oauth): add builder for provider (#423)
1 parent becd5d6 commit 2539c83

7 files changed

Lines changed: 16 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
jobs:
1313
rust:
1414
name: Rust
15-
uses: RustForWeb/.github/.github/workflows/rust.yml@c18f3b7315df398b6af8d03f823e31daeda63114
15+
uses: RustForWeb/.github/.github/workflows/rust.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
1616
with:
1717
enable-test: false
1818
target: wasm32-unknown-unknown

.github/workflows/labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ permissions:
1010
jobs:
1111
labels:
1212
name: Labels
13-
uses: RustForWeb/.github/.github/workflows/labels.yml@c18f3b7315df398b6af8d03f823e31daeda63114
13+
uses: RustForWeb/.github/.github/workflows/labels.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ permissions:
1111
jobs:
1212
publish:
1313
name: Publish
14-
uses: RustForWeb/.github/.github/workflows/publish.yml@c18f3b7315df398b6af8d03f823e31daeda63114
14+
uses: RustForWeb/.github/.github/workflows/publish.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ permissions:
1818
jobs:
1919
release:
2020
name: Release
21-
uses: RustForWeb/.github/.github/workflows/release.yml@c18f3b7315df398b6af8d03f823e31daeda63114
21+
uses: RustForWeb/.github/.github/workflows/release.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
2222
with:
2323
bump: ${{ inputs.bump }}

.github/workflows/website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ concurrency:
1818
jobs:
1919
book:
2020
name: Book
21-
uses: RustForWeb/.github/.github/workflows/book.yml@c18f3b7315df398b6af8d03f823e31daeda63114
21+
uses: RustForWeb/.github/.github/workflows/book.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
2222
with:
2323
combine: false

deny.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ all-features = true
55
ignore = [
66
{ id = "RUSTSEC-2023-0071", reason = "No safe upgrade available for `rsa`." },
77
{ id = "RUSTSEC-2024-0436", reason = "No maintained version available for `paste`." },
8+
{ id = "RUSTSEC-2026-0173", reason = "No maintained version available for `proc-macro-error2`." },
89
]
910
yanked = "deny"
1011

packages/methods/shield-oauth/src/provider.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use bon::Builder;
12
use oauth2::{
23
AuthUrl, Client, ClientId, ClientSecret, EndpointMaybeSet, EndpointNotSet, IntrospectionUrl,
34
RedirectUrl, RevocationUrl, StandardRevocableToken, TokenUrl,
@@ -37,11 +38,18 @@ pub enum OauthProviderPkceCodeChallenge {
3738
S256,
3839
}
3940

40-
#[derive(Clone, Debug)]
41+
#[expect(clippy::duplicated_attributes)]
42+
#[derive(Builder, Clone, Debug)]
43+
#[builder(
44+
on(String, into),
45+
on(SecretString, into),
46+
state_mod(vis = "pub(crate)")
47+
)]
4148
pub struct OauthProvider {
4249
pub id: String,
4350
pub name: String,
4451
pub slug: Option<String>,
52+
#[builder(default = OauthProviderVisibility::Public)]
4553
pub visibility: OauthProviderVisibility,
4654
pub client_id: String,
4755
pub client_secret: Option<SecretString>,
@@ -55,6 +63,7 @@ pub struct OauthProvider {
5563
pub introspection_url_params: Option<String>,
5664
pub revocation_url: Option<String>,
5765
pub revocation_url_params: Option<String>,
66+
#[builder(default = OauthProviderPkceCodeChallenge::S256)]
5867
pub pkce_code_challenge: OauthProviderPkceCodeChallenge,
5968
pub icon_url: Option<String>,
6069
}

0 commit comments

Comments
 (0)