Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/firebase_auth/firebase_auth_web/lib/src/interop/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,26 @@ class TwitterAuthProvider
auth_interop.TwitterAuthProviderJsImpl.credential(token, secret);
}

/// SAML auth provider.
///
/// See: <https://firebase.google.com/docs/reference/js/auth.samlauthprovider>.
class SAMLAuthProvider
extends AuthProvider<auth_interop.SAMLAuthProviderJsImpl> {
/// Creates a new SAMLAuthProvider with the providerId.
/// The providerId must start with "saml."
factory SAMLAuthProvider(String providerId) => SAMLAuthProvider.fromJsObject(
auth_interop.SAMLAuthProviderJsImpl(providerId));

/// Creates a new SAMLAuthProvider from a [jsObject].
SAMLAuthProvider.fromJsObject(auth_interop.SAMLAuthProviderJsImpl jsObject)
: super.fromJsObject(jsObject);

/// Used to extract the underlying OAuthCredential from a UserCredential.
static auth_interop.OAuthCredential? credentialFromResult(
auth_interop.UserCredentialJsImpl userCredential) =>
auth_interop.SAMLAuthProviderJsImpl.credentialFromResult(userCredential);
}

/// Phone number auth provider.
///
/// See: <https://firebase.google.com/docs/reference/js/firebase.auth.PhoneAuthProvider>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,14 @@ class PhoneAuthProviderJsImpl extends AuthProviderJsImpl {
);
}

@JS('SAMLAuthProvider')
class SAMLAuthProviderJsImpl extends AuthProviderJsImpl {
external factory SAMLAuthProviderJsImpl(String providerId);
external static OAuthCredential? credentialFromResult(
UserCredentialJsImpl userCredential,
);
}

@JS('ApplicationVerifier')
abstract class ApplicationVerifierJsImpl {
external String get type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ auth_interop.AuthProvider convertPlatformAuthProvider(
return oAuthProvider;
}

if (authProvider is SAMLAuthProvider) {
return auth_interop.SAMLAuthProvider(authProvider.providerId);
}

throw FallThroughError();
}

Expand Down