Skip to content

Commit

Permalink
Adds configuration for One (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikos-kitmeridis authored Sep 12, 2024
1 parent d75fa17 commit f677939
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ fastcrypto/Cargo.lock
fastcrypto-derive/Cargo.lock

# .DS_Store files
.DS_Store
.DS_Store

.idea
1 change: 1 addition & 0 deletions fastcrypto-zkp/src/bn254/unit_tests/zk_login_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ async fn test_get_jwks() {
OIDCProvider::Credenza3,
OIDCProvider::Playtron,
OIDCProvider::Threedos,
OIDCProvider::Onefc,
] {
let res = fetch_jwks(&p, &client).await;
assert!(res.is_ok());
Expand Down
1 change: 1 addition & 0 deletions fastcrypto-zkp/src/bn254/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub fn get_oidc_url(
OIDCProvider::Microsoft => format!("https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={}&scope=openid&response_type=id_token&redirect_uri={}&nonce={}", client_id, redirect_url, nonce),
OIDCProvider::KarrierOne => format!("https://accounts.karrier.one/Account/PhoneLogin?ReturnUrl=/connect/authorize?nonce={}&redirect_uri={}&response_type=id_token&scope=openid&client_id={}", nonce, redirect_url, client_id),
OIDCProvider::Credenza3 => format!("https://accounts.credenza3.com/oauth2/authorize?client_id={}&response_type=token&scope=openid+profile+email+phone&redirect_uri={}&nonce={}&state=state", client_id, redirect_url, nonce),
OIDCProvider::Onefc => format!("https://login.onepassport.onefc.com/de3ee5c1-5644-4113-922d-e8336569a462/b2c_1a_prod_signupsignin_onesuizklogin/oauth2/v2.0/authorize?client_id={}&scope=openid&response_type=id_token&redirect_uri={}&nonce={}", client_id, redirect_url, nonce),
OIDCProvider::AwsTenant((region, tenant_id)) => format!("https://{}.auth.{}.amazoncognito.com/login?response_type=token&client_id={}&redirect_uri={}&nonce={}", tenant_id, region, client_id, redirect_url, nonce),
OIDCProvider::TestIssuer => return Err(FastCryptoError::InvalidInput), // Test issuer does not issue JWTs interactively, this is not valid to call.
OIDCProvider::Playtron => return Err(FastCryptoError::InvalidInput), // Playtron does not issue JWTs interactively, this is not valid to call.
Expand Down
9 changes: 9 additions & 0 deletions fastcrypto-zkp/src/bn254/zk_login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ pub enum OIDCProvider {
Playtron,
/// https://auth.3dos.io/.well-known/openid-configuration
Threedos,
/// https://login.onepassport.onefc.com/de3ee5c1-5644-4113-922d-e8336569a462/b2c_1a_prod_signupsignin_onesuizklogin/v2.0/.well-known/openid-configuration
Onefc,
}

impl FromStr for OIDCProvider {
Expand All @@ -134,6 +136,7 @@ impl FromStr for OIDCProvider {
"Credenza3" => Ok(Self::Credenza3),
"Playtron" => Ok(Self::Playtron),
"Threedos" => Ok(Self::Threedos),
"Onefc" => Ok(Self::Onefc),
_ => {
let re = Regex::new(
r"AwsTenant-region:(?P<region>[^.]+)-tenant_id:(?P<tenant_id>[^/]+)",
Expand Down Expand Up @@ -166,6 +169,7 @@ impl ToString for OIDCProvider {
Self::Credenza3 => "Credenza3".to_string(),
Self::Playtron => "Playtron".to_string(),
Self::Threedos => "Threedos".to_string(),
Self::Onefc => "Onefc".to_string(),
Self::AwsTenant((region, tenant_id)) => {
format!("AwsTenant-region:{}-tenant_id:{}", region, tenant_id)
}
Expand Down Expand Up @@ -231,6 +235,10 @@ impl OIDCProvider {
"https://auth.3dos.io",
"https://auth.3dos.io/.well-known/jwks.json",
),
OIDCProvider::Onefc => ProviderConfig::new(
"https://login.onepassport.onefc.com/de3ee5c1-5644-4113-922d-e8336569a462/v2.0/",
"https://login.onepassport.onefc.com/de3ee5c1-5644-4113-922d-e8336569a462/b2c_1a_prod_signupsignin_onesuizklogin/discovery/v2.0/keys",
),
}
}

Expand All @@ -248,6 +256,7 @@ impl OIDCProvider {
"https://accounts.credenza3.com" => Ok(Self::Credenza3),
"https://oauth2.playtron.one" => Ok(Self::Playtron),
"https://auth.3dos.io" => Ok(Self::Threedos),
"https://https://login.onepassport.onefc.com/de3ee5c1-5644-4113-922d-e8336569a462/v2.0/" => Ok(Self::Onefc),
iss if match_micrsoft_iss_substring(iss) => Ok(Self::Microsoft),
_ => match parse_aws_iss_substring(iss) {
Ok((region, tenant_id)) => {
Expand Down
6 changes: 6 additions & 0 deletions fastcrypto-zkp/src/bn254/zklogin_test_vectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@
"kid": "6d361dc9637a275eb585a915af26198ff0d97326ca13f4baf0e4805f72f2a9a0",
"n": "y_8hHwq7w2yE4968sbQF98iGUhnu0BwyB5khTxVPAcUnMCYdp61zYcRWml2zdY4HAfq-Nnjb_pAli6I66Vpe9IE8Gf8uGRB0oYIo2S6tYMEe0lhRaEDYVbMdQkuKxTIYMNBXSd_kCHKJM1ZUAo7uFoq_bWuzt2hRG2-79z-Ycbiw0wil0rzFHlpNBKsBLKM4GSGUwOejaL2zCiE_rjf77AvOaJLRd4I_DBYG16t8D1BkxbhkcQCmOxYGG0NqjP3z0lz-w1ALqHCNfhzczZOsgaCrbSlcTKcBTq1syAUUhQmounW7nG5clBIfPQRVH7jCoPztiJUZg6Xz1AN6V07xnw",
"provider": "Threedos"
},
{
"jwt": "eyJhbGciOiJSUzI1NiIsImtpZCI6IlgteXpGUEZNZFd0SlExb0pYaUdSVm5uMDYxZXpydlp6NTk2eE4zbUNmeVEiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MjM3MDAyOTQsIm5iZiI6MTcyMzYxMzg5NCwidmVyIjoiMS4wIiwiaXNzIjoiaHR0cHM6Ly9sb2dpbi5vbmVwYXNzcG9ydC5vbmVmYy5jb20vZGUzZWU1YzEtNTY0NC00MTEzLTkyMmQtZTgzMzY1NjlhNDYyL3YyLjAvIiwic3ViIjoiNzVmMTYxZ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SotKQ",
"provider": "Onefc"
}
]

0 comments on commit f677939

Please sign in to comment.