-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e88d542
commit 9f439fb
Showing
9 changed files
with
91 additions
and
85 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mod google; | ||
mod keycloak; | ||
|
||
pub use google::*; | ||
pub use keycloak::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use crate::subprovider::{ | ||
oidc_subprovider_builder::{SetClientId, SetDiscoveryUrl, SetId, SetName}, | ||
OidcSubprovider, OidcSubproviderBuilder, | ||
}; | ||
|
||
pub struct Google {} | ||
|
||
impl Google { | ||
pub fn builder( | ||
id: &str, | ||
client_id: &str, | ||
) -> OidcSubproviderBuilder<SetDiscoveryUrl<SetClientId<SetName<SetId>>>> { | ||
OidcSubprovider::builder() | ||
.id(id) | ||
.name("Google") | ||
.client_id(client_id) | ||
.discovery_url("https://accounts.google.com") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,20 @@ | ||
use crate::subprovider::{OidcProviderPkceCodeChallenge, OidcProviderVisibility, OidcSubprovider}; | ||
use crate::subprovider::{ | ||
oidc_subprovider_builder::{SetClientId, SetDiscoveryUrl, SetId, SetName}, | ||
OidcSubprovider, OidcSubproviderBuilder, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub struct KeycloakBuilder { | ||
id: String, | ||
name: String, | ||
discovery_url: String, | ||
client_id: String, | ||
client_secret: Option<String>, | ||
redirect_url: Option<String>, | ||
} | ||
|
||
impl KeycloakBuilder { | ||
pub fn new(id: &str, discovery_url: &str, client_id: &str) -> Self { | ||
Self { | ||
id: id.to_owned(), | ||
name: "Keycloak".to_owned(), | ||
discovery_url: discovery_url.to_owned(), | ||
client_id: client_id.to_owned(), | ||
client_secret: None, | ||
redirect_url: None, | ||
} | ||
} | ||
|
||
pub fn name(mut self, name: &str) -> Self { | ||
self.name = name.to_owned(); | ||
self | ||
} | ||
|
||
pub fn client_secret(mut self, client_secret: &str) -> Self { | ||
self.client_secret = Some(client_secret.to_owned()); | ||
self | ||
} | ||
|
||
pub fn redirect_url(mut self, redirect_url: &str) -> Self { | ||
self.redirect_url = Some(redirect_url.to_owned()); | ||
self | ||
} | ||
pub struct Keycloak {} | ||
|
||
pub fn build(self) -> OidcSubprovider { | ||
OidcSubprovider { | ||
id: self.id, | ||
name: self.name, | ||
slug: None, | ||
visibility: OidcProviderVisibility::Public, | ||
client_id: self.client_id, | ||
client_secret: self.client_secret, | ||
scopes: None, | ||
redirect_url: self.redirect_url, | ||
discovery_url: Some(self.discovery_url), | ||
issuer_url: None, | ||
authorization_url: None, | ||
authorization_url_params: None, | ||
token_url: None, | ||
token_url_params: None, | ||
introspection_url: None, | ||
introspection_url_params: None, | ||
revocation_url: None, | ||
revocation_url_params: None, | ||
user_info_url: None, | ||
json_web_key_set_url: None, | ||
json_web_key_set: None, | ||
pkce_code_challenge: OidcProviderPkceCodeChallenge::S256, | ||
} | ||
impl Keycloak { | ||
pub fn builder( | ||
id: &str, | ||
discovery_url: &str, | ||
client_id: &str, | ||
) -> OidcSubproviderBuilder<SetDiscoveryUrl<SetClientId<SetName<SetId>>>> { | ||
OidcSubprovider::builder() | ||
.id(id) | ||
.name("Keycloak") | ||
.client_id(client_id) | ||
.discovery_url(discovery_url) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters