-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
16 changed files
with
405 additions
and
164 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use synd_auth::{ | ||
device_flow::{provider, DeviceFlow}, | ||
jwt, | ||
}; | ||
|
||
pub struct DeviceFlows { | ||
pub github: DeviceFlow<provider::Github>, | ||
pub google: DeviceFlow<provider::Google>, | ||
} | ||
|
||
pub struct JwtService { | ||
pub google: jwt::google::JwtService, | ||
} | ||
|
||
impl JwtService { | ||
pub fn new() -> Self { | ||
Self { | ||
google: jwt::google::JwtService::default(), | ||
} | ||
} | ||
} | ||
|
||
pub struct Authenticator { | ||
pub device_flows: DeviceFlows, | ||
pub jwt_decoders: JwtService, | ||
} | ||
|
||
impl Authenticator { | ||
pub fn new() -> Self { | ||
Self { | ||
device_flows: DeviceFlows { | ||
github: DeviceFlow::new(provider::Github::default()), | ||
google: DeviceFlow::new(provider::Google::default()), | ||
}, | ||
jwt_decoders: JwtService::new(), | ||
} | ||
} | ||
|
||
#[must_use] | ||
pub fn with_device_flows(self, device_flows: DeviceFlows) -> Self { | ||
Self { | ||
device_flows, | ||
..self | ||
} | ||
} | ||
} |
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
Oops, something went wrong.