├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── dependabot.yml
├── resources
│ ├── firebase.asc.gpg
│ ├── integ-service-account.json.gpg
│ └── settings.xml
├── scripts
│ ├── generate_changelog.sh
│ ├── package_artifacts.sh
│ ├── publish_artifacts.sh
│ └── publish_preflight_check.sh
└── workflows
│ ├── ci.yml
│ ├── nightly.yml
│ └── release.yml
├── .gitignore
├── .opensource
└── project.json
├── CONTRIBUTING.md
├── LICENSE
├── NOTICE.txt
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── checkstyle.xml
├── pom.xml
├── prepare_release.sh
└── src
├── main
├── java
│ └── com
│ │ └── google
│ │ └── firebase
│ │ ├── ErrorCode.java
│ │ ├── FirebaseApp.java
│ │ ├── FirebaseAppLifecycleListener.java
│ │ ├── FirebaseException.java
│ │ ├── FirebaseOptions.java
│ │ ├── ImplFirebaseTrampolines.java
│ │ ├── IncomingHttpResponse.java
│ │ ├── OutgoingHttpRequest.java
│ │ ├── ThreadManager.java
│ │ ├── auth
│ │ ├── AbstractFirebaseAuth.java
│ │ ├── ActionCodeSettings.java
│ │ ├── AuthErrorCode.java
│ │ ├── DeleteUsersResult.java
│ │ ├── EmailIdentifier.java
│ │ ├── ErrorInfo.java
│ │ ├── ExportedUserRecord.java
│ │ ├── FirebaseAuth.java
│ │ ├── FirebaseAuthException.java
│ │ ├── FirebaseToken.java
│ │ ├── FirebaseTokenUtils.java
│ │ ├── FirebaseTokenVerifier.java
│ │ ├── FirebaseTokenVerifierImpl.java
│ │ ├── FirebaseUserManager.java
│ │ ├── GetUsersResult.java
│ │ ├── ImportUserRecord.java
│ │ ├── ListProviderConfigsPage.java
│ │ ├── ListUsersPage.java
│ │ ├── OidcProviderConfig.java
│ │ ├── PhoneIdentifier.java
│ │ ├── ProviderConfig.java
│ │ ├── ProviderIdentifier.java
│ │ ├── ProviderUserInfo.java
│ │ ├── RevocationCheckDecorator.java
│ │ ├── SamlProviderConfig.java
│ │ ├── SessionCookieOptions.java
│ │ ├── UidIdentifier.java
│ │ ├── UserIdentifier.java
│ │ ├── UserImportHash.java
│ │ ├── UserImportOptions.java
│ │ ├── UserImportResult.java
│ │ ├── UserInfo.java
│ │ ├── UserMetadata.java
│ │ ├── UserProvider.java
│ │ ├── UserRecord.java
│ │ ├── hash
│ │ │ ├── Argon2.java
│ │ │ ├── Bcrypt.java
│ │ │ ├── Hmac.java
│ │ │ ├── HmacMd5.java
│ │ │ ├── HmacSha1.java
│ │ │ ├── HmacSha256.java
│ │ │ ├── HmacSha512.java
│ │ │ ├── Md5.java
│ │ │ ├── Pbkdf2Sha256.java
│ │ │ ├── PbkdfSha1.java
│ │ │ ├── RepeatableHash.java
│ │ │ ├── Scrypt.java
│ │ │ ├── Sha1.java
│ │ │ ├── Sha256.java
│ │ │ ├── Sha512.java
│ │ │ └── StandardScrypt.java
│ │ ├── internal
│ │ │ ├── AuthErrorHandler.java
│ │ │ ├── AuthHttpClient.java
│ │ │ ├── BatchDeleteResponse.java
│ │ │ ├── CryptoSigner.java
│ │ │ ├── CryptoSigners.java
│ │ │ ├── DownloadAccountResponse.java
│ │ │ ├── FirebaseCustomAuthToken.java
│ │ │ ├── FirebaseTokenFactory.java
│ │ │ ├── GetAccountInfoRequest.java
│ │ │ ├── GetAccountInfoResponse.java
│ │ │ ├── ListOidcProviderConfigsResponse.java
│ │ │ ├── ListProviderConfigsResponse.java
│ │ │ ├── ListSamlProviderConfigsResponse.java
│ │ │ ├── ListTenantsResponse.java
│ │ │ ├── UploadAccountResponse.java
│ │ │ ├── Utils.java
│ │ │ └── package-info.java
│ │ └── multitenancy
│ │ │ ├── FirebaseTenantClient.java
│ │ │ ├── ListTenantsPage.java
│ │ │ ├── Tenant.java
│ │ │ ├── TenantAwareFirebaseAuth.java
│ │ │ └── TenantManager.java
│ │ ├── cloud
│ │ ├── FirestoreClient.java
│ │ └── StorageClient.java
│ │ ├── database
│ │ ├── ChildEventListener.java
│ │ ├── DataSnapshot.java
│ │ ├── DatabaseError.java
│ │ ├── DatabaseException.java
│ │ ├── DatabaseReference.java
│ │ ├── Exclude.java
│ │ ├── FirebaseDatabase.java
│ │ ├── GenericTypeIndicator.java
│ │ ├── IgnoreExtraProperties.java
│ │ ├── InternalHelpers.java
│ │ ├── MutableData.java
│ │ ├── OnDisconnect.java
│ │ ├── PropertyName.java
│ │ ├── Query.java
│ │ ├── ServerValue.java
│ │ ├── ThrowOnExtraProperties.java
│ │ ├── Transaction.java
│ │ ├── ValueEventListener.java
│ │ ├── annotations
│ │ │ ├── NotNull.java
│ │ │ ├── Nullable.java
│ │ │ └── package-info.java
│ │ ├── collection
│ │ │ ├── ArraySortedMap.java
│ │ │ ├── ImmutableSortedMap.java
│ │ │ ├── ImmutableSortedMapIterator.java
│ │ │ ├── ImmutableSortedSet.java
│ │ │ ├── LLRBBlackValueNode.java
│ │ │ ├── LLRBEmptyNode.java
│ │ │ ├── LLRBNode.java
│ │ │ ├── LLRBRedValueNode.java
│ │ │ ├── LLRBValueNode.java
│ │ │ ├── RBTreeSortedMap.java
│ │ │ ├── StandardComparator.java
│ │ │ └── package-info.java
│ │ ├── connection
│ │ │ ├── CompoundHash.java
│ │ │ ├── Connection.java
│ │ │ ├── ConnectionAuthTokenProvider.java
│ │ │ ├── ConnectionContext.java
│ │ │ ├── ConnectionUtils.java
│ │ │ ├── Constants.java
│ │ │ ├── HostInfo.java
│ │ │ ├── ListenHashProvider.java
│ │ │ ├── NettyWebSocketClient.java
│ │ │ ├── PersistentConnection.java
│ │ │ ├── PersistentConnectionImpl.java
│ │ │ ├── RangeMerge.java
│ │ │ ├── RequestResultCallback.java
│ │ │ ├── WebsocketConnection.java
│ │ │ ├── package-info.java
│ │ │ └── util
│ │ │ │ ├── RetryHelper.java
│ │ │ │ └── package-info.java
│ │ ├── core
│ │ │ ├── AuthTokenProvider.java
│ │ │ ├── ChildEventRegistration.java
│ │ │ ├── CompoundWrite.java
│ │ │ ├── Constants.java
│ │ │ ├── Context.java
│ │ │ ├── DatabaseConfig.java
│ │ │ ├── EventRegistration.java
│ │ │ ├── EventRegistrationZombieListener.java
│ │ │ ├── EventTarget.java
│ │ │ ├── JvmAuthTokenProvider.java
│ │ │ ├── JvmPlatform.java
│ │ │ ├── Path.java
│ │ │ ├── Platform.java
│ │ │ ├── Repo.java
│ │ │ ├── RepoInfo.java
│ │ │ ├── RepoManager.java
│ │ │ ├── RunLoop.java
│ │ │ ├── ServerValues.java
│ │ │ ├── SnapshotHolder.java
│ │ │ ├── SparseSnapshotTree.java
│ │ │ ├── SyncPoint.java
│ │ │ ├── SyncTree.java
│ │ │ ├── Tag.java
│ │ │ ├── ThreadPoolEventTarget.java
│ │ │ ├── UserWriteRecord.java
│ │ │ ├── ValidationPath.java
│ │ │ ├── ValueEventRegistration.java
│ │ │ ├── WriteTree.java
│ │ │ ├── WriteTreeRef.java
│ │ │ ├── ZombieEventManager.java
│ │ │ ├── operation
│ │ │ │ ├── AckUserWrite.java
│ │ │ │ ├── ListenComplete.java
│ │ │ │ ├── Merge.java
│ │ │ │ ├── Operation.java
│ │ │ │ ├── OperationSource.java
│ │ │ │ ├── Overwrite.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ ├── persistence
│ │ │ │ ├── CachePolicy.java
│ │ │ │ ├── DefaultPersistenceManager.java
│ │ │ │ ├── LRUCachePolicy.java
│ │ │ │ ├── NoopPersistenceManager.java
│ │ │ │ ├── PersistenceManager.java
│ │ │ │ ├── PersistenceStorageEngine.java
│ │ │ │ ├── PruneForest.java
│ │ │ │ ├── TrackedQuery.java
│ │ │ │ ├── TrackedQueryManager.java
│ │ │ │ └── package-info.java
│ │ │ ├── utilities
│ │ │ │ ├── ImmutableTree.java
│ │ │ │ ├── Predicate.java
│ │ │ │ ├── Tree.java
│ │ │ │ ├── TreeNode.java
│ │ │ │ └── package-info.java
│ │ │ └── view
│ │ │ │ ├── CacheNode.java
│ │ │ │ ├── CancelEvent.java
│ │ │ │ ├── Change.java
│ │ │ │ ├── DataEvent.java
│ │ │ │ ├── Event.java
│ │ │ │ ├── EventGenerator.java
│ │ │ │ ├── EventRaiser.java
│ │ │ │ ├── QueryParams.java
│ │ │ │ ├── QuerySpec.java
│ │ │ │ ├── View.java
│ │ │ │ ├── ViewCache.java
│ │ │ │ ├── ViewProcessor.java
│ │ │ │ ├── filter
│ │ │ │ ├── ChildChangeAccumulator.java
│ │ │ │ ├── IndexedFilter.java
│ │ │ │ ├── LimitedFilter.java
│ │ │ │ ├── NodeFilter.java
│ │ │ │ ├── RangedFilter.java
│ │ │ │ └── package-info.java
│ │ │ │ └── package-info.java
│ │ ├── snapshot
│ │ │ ├── BooleanNode.java
│ │ │ ├── ChildKey.java
│ │ │ ├── ChildrenNode.java
│ │ │ ├── CompoundHash.java
│ │ │ ├── DeferredValueNode.java
│ │ │ ├── DoubleNode.java
│ │ │ ├── EmptyNode.java
│ │ │ ├── Index.java
│ │ │ ├── IndexedNode.java
│ │ │ ├── KeyIndex.java
│ │ │ ├── LeafNode.java
│ │ │ ├── LongNode.java
│ │ │ ├── NamedNode.java
│ │ │ ├── Node.java
│ │ │ ├── NodeUtilities.java
│ │ │ ├── PathIndex.java
│ │ │ ├── PriorityIndex.java
│ │ │ ├── PriorityUtilities.java
│ │ │ ├── RangeMerge.java
│ │ │ ├── StringNode.java
│ │ │ ├── ValueIndex.java
│ │ │ └── package-info.java
│ │ ├── util
│ │ │ ├── EmulatorHelper.java
│ │ │ ├── GAuthToken.java
│ │ │ ├── JsonMapper.java
│ │ │ └── package-info.java
│ │ └── utilities
│ │ │ ├── Clock.java
│ │ │ ├── DefaultClock.java
│ │ │ ├── DefaultRunLoop.java
│ │ │ ├── NodeSizeEstimator.java
│ │ │ ├── OffsetClock.java
│ │ │ ├── Pair.java
│ │ │ ├── ParsedUrl.java
│ │ │ ├── PushIdGenerator.java
│ │ │ ├── Utilities.java
│ │ │ ├── Validation.java
│ │ │ ├── encoding
│ │ │ ├── CustomClassMapper.java
│ │ │ └── package-info.java
│ │ │ └── package-info.java
│ │ ├── iid
│ │ ├── FirebaseInstanceId.java
│ │ └── FirebaseInstanceIdException.java
│ │ ├── internal
│ │ ├── AbstractHttpErrorHandler.java
│ │ ├── AbstractPlatformErrorHandler.java
│ │ ├── ApacheHttp2AsyncEntityProducer.java
│ │ ├── ApacheHttp2Request.java
│ │ ├── ApacheHttp2Response.java
│ │ ├── ApacheHttp2Transport.java
│ │ ├── ApiClientUtils.java
│ │ ├── ApplicationDefaultCredentialsProvider.java
│ │ ├── CallableOperation.java
│ │ ├── DateUtils.java
│ │ ├── EmulatorCredentials.java
│ │ ├── ErrorHandlingHttpClient.java
│ │ ├── FirebaseProcessEnvironment.java
│ │ ├── FirebaseRequestInitializer.java
│ │ ├── FirebaseScheduledExecutor.java
│ │ ├── FirebaseService.java
│ │ ├── FirebaseThreadManagers.java
│ │ ├── GuardedBy.java
│ │ ├── HttpErrorHandler.java
│ │ ├── HttpRequestInfo.java
│ │ ├── ListenableFuture2ApiFuture.java
│ │ ├── MockApacheHttp2AsyncClient.java
│ │ ├── NonNull.java
│ │ ├── Nullable.java
│ │ ├── RetryConfig.java
│ │ ├── RetryInitializer.java
│ │ ├── RetryUnsuccessfulResponseHandler.java
│ │ ├── SdkUtils.java
│ │ └── package-info.java
│ │ ├── messaging
│ │ ├── AndroidConfig.java
│ │ ├── AndroidFcmOptions.java
│ │ ├── AndroidNotification.java
│ │ ├── ApnsConfig.java
│ │ ├── ApnsFcmOptions.java
│ │ ├── Aps.java
│ │ ├── ApsAlert.java
│ │ ├── BatchResponse.java
│ │ ├── BatchResponseImpl.java
│ │ ├── CriticalSound.java
│ │ ├── FcmOptions.java
│ │ ├── FcmOptionsUtil.java
│ │ ├── FirebaseMessaging.java
│ │ ├── FirebaseMessagingClient.java
│ │ ├── FirebaseMessagingClientImpl.java
│ │ ├── FirebaseMessagingException.java
│ │ ├── InstanceIdClient.java
│ │ ├── InstanceIdClientImpl.java
│ │ ├── LightSettings.java
│ │ ├── LightSettingsColor.java
│ │ ├── Message.java
│ │ ├── MessagingErrorCode.java
│ │ ├── MulticastMessage.java
│ │ ├── Notification.java
│ │ ├── SendResponse.java
│ │ ├── TopicManagementResponse.java
│ │ ├── WebpushConfig.java
│ │ ├── WebpushFcmOptions.java
│ │ ├── WebpushNotification.java
│ │ └── internal
│ │ │ ├── MessagingServiceErrorResponse.java
│ │ │ ├── MessagingServiceResponse.java
│ │ │ └── package-info.java
│ │ ├── projectmanagement
│ │ ├── AndroidApp.java
│ │ ├── AndroidAppMetadata.java
│ │ ├── AndroidAppService.java
│ │ ├── FirebaseProjectManagement.java
│ │ ├── FirebaseProjectManagementException.java
│ │ ├── FirebaseProjectManagementServiceImpl.java
│ │ ├── HttpHelper.java
│ │ ├── IosApp.java
│ │ ├── IosAppMetadata.java
│ │ ├── IosAppService.java
│ │ ├── Scheduler.java
│ │ ├── ShaCertificate.java
│ │ └── ShaCertificateType.java
│ │ └── remoteconfig
│ │ ├── Condition.java
│ │ ├── FirebaseRemoteConfig.java
│ │ ├── FirebaseRemoteConfigClient.java
│ │ ├── FirebaseRemoteConfigClientImpl.java
│ │ ├── FirebaseRemoteConfigException.java
│ │ ├── ListVersionsOptions.java
│ │ ├── ListVersionsPage.java
│ │ ├── Parameter.java
│ │ ├── ParameterGroup.java
│ │ ├── ParameterValue.java
│ │ ├── ParameterValueType.java
│ │ ├── PublishOptions.java
│ │ ├── RemoteConfigErrorCode.java
│ │ ├── RemoteConfigUtil.java
│ │ ├── TagColor.java
│ │ ├── Template.java
│ │ ├── User.java
│ │ ├── Version.java
│ │ └── internal
│ │ ├── RemoteConfigServiceErrorResponse.java
│ │ ├── TemplateResponse.java
│ │ └── package-info.java
└── resources
│ └── admin_sdk.properties
└── test
├── java
└── com
│ └── google
│ └── firebase
│ ├── CodeCoverageReporter.java
│ ├── FirebaseAppTest.java
│ ├── FirebaseExceptionTest.java
│ ├── FirebaseOptionsTest.java
│ ├── IncomingHttpResponseTest.java
│ ├── OutgoingHttpRequestTest.java
│ ├── TestOnlyImplFirebaseTrampolines.java
│ ├── ThreadManagerTest.java
│ ├── auth
│ ├── ActionCodeSettingsTest.java
│ ├── EmulatorFirebaseTokenVerifierImplTest.java
│ ├── FirebaseAuthIT.java
│ ├── FirebaseAuthTest.java
│ ├── FirebaseCustomTokenTest.java
│ ├── FirebaseTokenTest.java
│ ├── FirebaseTokenUtilsTest.java
│ ├── FirebaseTokenVerifierImplTest.java
│ ├── FirebaseTokenVerifierImplTestUtils.java
│ ├── FirebaseUserManagerTest.java
│ ├── GetUsersIT.java
│ ├── ImportUserRecordTest.java
│ ├── ListProviderConfigsPageTest.java
│ ├── ListUsersPageTest.java
│ ├── MockGoogleCredentials.java
│ ├── MockTokenVerifier.java
│ ├── OidcProviderConfigTest.java
│ ├── ProviderConfigTestUtils.java
│ ├── SamlProviderConfigTest.java
│ ├── TestTokenFactory.java
│ ├── UserImportHashTest.java
│ ├── UserImportOptionsTest.java
│ ├── UserProviderTest.java
│ ├── UserRecordTest.java
│ ├── UserTestUtils.java
│ ├── hash
│ │ └── InvalidHashTest.java
│ ├── internal
│ │ ├── CryptoSignersTest.java
│ │ ├── FirebaseTokenFactoryTest.java
│ │ ├── ListOidcProviderConfigsResponseTest.java
│ │ ├── ListSamlProviderConfigsResponseTest.java
│ │ └── ListTenantsResponseTest.java
│ └── multitenancy
│ │ ├── FirebaseTenantClientTest.java
│ │ ├── ListTenantsPageTest.java
│ │ ├── TenantAwareFirebaseAuthIT.java
│ │ ├── TenantAwareFirebaseAuthTest.java
│ │ ├── TenantManagerIT.java
│ │ └── TenantTest.java
│ ├── cloud
│ ├── FirestoreClientIT.java
│ ├── FirestoreClientTest.java
│ ├── StorageClientIT.java
│ └── StorageClientTest.java
│ ├── database
│ ├── DataSnapshotTest.java
│ ├── DatabaseErrorTest.java
│ ├── DatabaseReferenceTest.java
│ ├── EventRecord.java
│ ├── FirebaseDatabaseTest.java
│ ├── MapBuilder.java
│ ├── MapperTest.java
│ ├── MutableDataTest.java
│ ├── ObjectMapTest.java
│ ├── OnDisconnectTest.java
│ ├── QueryTest.java
│ ├── TestChildEventListener.java
│ ├── TestFailure.java
│ ├── TestHelpers.java
│ ├── TestTokenProvider.java
│ ├── UtilitiesTest.java
│ ├── ValueExpectationHelper.java
│ ├── collection
│ │ ├── ArraySortedMapTest.java
│ │ ├── ImmutableSortedSetTest.java
│ │ └── RBTreeSortedMapTest.java
│ ├── connection
│ │ ├── ConnectionTest.java
│ │ ├── ConnectionUtilsTest.java
│ │ ├── ListenAggregator.java
│ │ ├── PersistentConnectionTest.java
│ │ └── WebsocketConnectionTest.java
│ ├── core
│ │ ├── CompoundWriteTest.java
│ │ ├── CoreTestHelpers.java
│ │ ├── JvmAuthTokenProviderTest.java
│ │ ├── JvmPlatformTest.java
│ │ ├── PathTest.java
│ │ ├── RandomOperationGenerator.java
│ │ ├── RandomViewProcessorTest.java
│ │ ├── RangeMergeTest.java
│ │ ├── RepoInfoTest.java
│ │ ├── RepoTest.java
│ │ ├── SyncPointTest.java
│ │ ├── ZombieVerifier.java
│ │ ├── persistence
│ │ │ ├── DefaultPersistenceManagerTest.java
│ │ │ ├── KeepSyncedTestIT.java
│ │ │ ├── MockListenProvider.java
│ │ │ ├── MockPersistenceStorageEngine.java
│ │ │ ├── PruneForestTest.java
│ │ │ ├── RandomPersistenceTest.java
│ │ │ ├── TestCachePolicy.java
│ │ │ └── TrackedQueryManagerTest.java
│ │ ├── utilities
│ │ │ ├── TestClock.java
│ │ │ └── TreeTest.java
│ │ └── view
│ │ │ ├── QueryParamsTest.java
│ │ │ └── ViewAccess.java
│ ├── future
│ │ ├── ReadFuture.java
│ │ └── WriteFuture.java
│ ├── integration
│ │ ├── DataTestIT.java
│ │ ├── EventHelper.java
│ │ ├── EventTestIT.java
│ │ ├── FirebaseDatabaseAuthTestIT.java
│ │ ├── FirebaseDatabaseTestIT.java
│ │ ├── InfoTestIT.java
│ │ ├── OrderByTestIT.java
│ │ ├── OrderTestIT.java
│ │ ├── QueryTestIT.java
│ │ ├── RealtimeTestIT.java
│ │ ├── RulesClient.java
│ │ ├── RulesTestIT.java
│ │ ├── ShutdownExample.java
│ │ └── TransactionTestIT.java
│ ├── snapshot
│ │ ├── CompoundHashTest.java
│ │ └── NodeTest.java
│ ├── util
│ │ ├── EmulatorHelperTest.java
│ │ ├── GAuthTokenTest.java
│ │ └── JsonMapperTest.java
│ └── utilities
│ │ ├── DefaultRunLoopTest.java
│ │ ├── NodeSizeEstimatorTest.java
│ │ ├── PairTest.java
│ │ ├── PushIdGeneratorTest.java
│ │ ├── UtilitiesTest.java
│ │ └── ValidationTest.java
│ ├── iid
│ ├── FirebaseInstanceIdIT.java
│ └── FirebaseInstanceIdTest.java
│ ├── internal
│ ├── AbstractPlatformErrorHandlerTest.java
│ ├── ApacheHttp2TransportIT.java
│ ├── ApacheHttp2TransportTest.java
│ ├── ApiClientUtilsTest.java
│ ├── CallableOperationTest.java
│ ├── CountingLowLevelHttpRequest.java
│ ├── DateUtilsTest.java
│ ├── ErrorHandlingHttpClientTest.java
│ ├── FirebaseAppStoreTest.java
│ ├── FirebaseRequestInitializerTest.java
│ ├── FirebaseThreadManagersTest.java
│ ├── MockApacheHttp2Response.java
│ ├── RetryConfigTest.java
│ ├── RetryInitializerTest.java
│ ├── RetryUnsuccessfulResponseHandlerTest.java
│ └── TestApiClientUtils.java
│ ├── messaging
│ ├── BatchResponseTest.java
│ ├── FirebaseMessagingClientImplTest.java
│ ├── FirebaseMessagingIT.java
│ ├── FirebaseMessagingTest.java
│ ├── InstanceIdClientImplTest.java
│ ├── MessageTest.java
│ ├── MulticastMessageTest.java
│ └── SendResponseTest.java
│ ├── projectmanagement
│ ├── AndroidAppTest.java
│ ├── FirebaseProjectManagementIT.java
│ ├── FirebaseProjectManagementServiceImplTest.java
│ ├── FirebaseProjectManagementTest.java
│ ├── IosAppTest.java
│ └── ShaCertificateTest.java
│ ├── remoteconfig
│ ├── ConditionTest.java
│ ├── FirebaseRemoteConfigClientImplTest.java
│ ├── FirebaseRemoteConfigIT.java
│ ├── FirebaseRemoteConfigTest.java
│ ├── ListVersionsPageTest.java
│ ├── MockRemoteConfigClient.java
│ ├── ParameterGroupTest.java
│ ├── ParameterTest.java
│ ├── ParameterValueTest.java
│ ├── TemplateTest.java
│ ├── UserTest.java
│ └── VersionTest.java
│ ├── snippets
│ ├── FirebaseAppSnippets.java
│ ├── FirebaseAuthSnippets.java
│ ├── FirebaseDatabaseSnippets.java
│ ├── FirebaseMessagingSnippets.java
│ └── FirebaseStorageSnippets.java
│ └── testing
│ ├── FirebaseAppRule.java
│ ├── GenericFunction.java
│ ├── IntegrationTestUtils.java
│ ├── MockitoTestRule.java
│ ├── MultiRequestMockHttpTransport.java
│ ├── ServiceAccount.java
│ ├── TestResponseInterceptor.java
│ └── TestUtils.java
└── resources
├── createSessionCookie.json
├── createUser.json
├── deleteUser.json
├── fcm_batch_failure.txt
├── fcm_batch_success.txt
├── firebase_config.json
├── firebase_config_empty.json
├── firebase_config_invalid.json
├── firebase_config_invalid_key.json
├── firebase_config_partial.json
├── generateEmailLink.json
├── getRemoteConfig.json
├── getUser.json
├── getUserError.json
├── importUsersError.json
├── listOidc.json
├── listRemoteConfigVersions.json
├── listSaml.json
├── listTenants.json
├── listUsers.json
├── oidc.json
├── saml.json
├── service_accounts
├── editor.json
├── editor_public_key.pem
├── none.json
├── none_public_key.pem
├── owner.json
├── owner_public_key.pem
├── viewer.json
└── viewer_public_key.pem
├── syncPointSpec.json
└── tenant.json
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### [READ] Step 1: Are you in the right place?
11 |
12 | * For issues or feature requests related to __the code in this repository__
13 | file a Github issue.
14 | * If this is a __feature request__ make sure the issue title starts with "FR:".
15 | * For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)
16 | with the firebase tag.
17 | * For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk)
18 | google group.
19 | * For help troubleshooting your application that does not fall under one
20 | of the above categories, reach out to the personalized
21 | [Firebase support channel](https://firebase.google.com/support/).
22 |
23 | ### [REQUIRED] Step 2: Describe your environment
24 |
25 | * Operating System version: _____
26 | * Firebase SDK version: _____
27 | * Library version: _____
28 | * Firebase Product: _____ (auth, database, storage, etc)
29 |
30 | ### [REQUIRED] Step 3: Describe the problem
31 |
32 | #### Steps to reproduce:
33 |
34 | What happened? How can we make the problem occur?
35 | This could be a description, log/console output, etc.
36 |
37 | #### Relevant Code:
38 |
39 | ```
40 | // TODO(you): code here to reproduce the problem
41 | ```
42 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: '[FR]'
5 | labels: 'type: feature request'
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "maven"
4 | directory: "/"
5 | schedule:
6 | interval: "weekly"
7 |
--------------------------------------------------------------------------------
/.github/resources/firebase.asc.gpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/firebase/firebase-admin-java/4f73761203316c3d84b9993aebb960c784f561bb/.github/resources/firebase.asc.gpg
--------------------------------------------------------------------------------
/.github/resources/integ-service-account.json.gpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/firebase/firebase-admin-java/4f73761203316c3d84b9993aebb960c784f561bb/.github/resources/integ-service-account.json.gpg
--------------------------------------------------------------------------------
/.github/resources/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | false
7 |
8 |
9 |
10 | ossrh
11 | ${env.NEXUS_OSSRH_USERNAME}
12 | ${env.NEXUS_OSSRH_PASSWORD}
13 |
14 |
15 |
16 |
17 |
18 | release
19 |
20 | true
21 |
22 |
23 | gpg
24 | 0A05D8FAD4287A36C53BE07714D6B82AEB1DD39C
25 | ${env.GPG_PASSPHRASE}
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/.github/scripts/package_artifacts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2020 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | set -e
18 | set -u
19 |
20 | gpg --quiet --batch --yes --decrypt --passphrase="${FIREBASE_SERVICE_ACCT_KEY}" \
21 | --output integration_cert.json .github/resources/integ-service-account.json.gpg
22 |
23 | echo "${FIREBASE_API_KEY}" > integration_apikey.txt
24 |
25 | # Does the following:
26 | # 1. Runs the Checkstyle plugin (validate phase)
27 | # 2. Compiles the source (compile phase)
28 | # 3. Runs the unit tests (test phase)
29 | # 4. Packages the artifacts - src, bin, javadocs (package phase)
30 | # 5. Runs the integration tests (verify phase)
31 | mvn -DtrimStackTrace=false -B clean verify
32 |
33 | # Maven target directory can consist of many files. Just copy the jar artifacts
34 | # into a new directory for upload.
35 | mkdir -p dist
36 | cp target/*.jar dist/
37 |
--------------------------------------------------------------------------------
/.github/scripts/publish_artifacts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2020 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | set -e
18 | set -u
19 |
20 | gpg --quiet --batch --yes --decrypt --passphrase="${GPG_PRIVATE_KEY}" \
21 | --output firebase.asc .github/resources/firebase.asc.gpg
22 |
23 | gpg --import --no-tty --batch --yes firebase.asc
24 |
25 | # Does the following:
26 | # 1. Compiles the source (compile phase)
27 | # 2. Packages the artifacts - src, bin, javadocs (package phase)
28 | # 3. Signs the artifacts (verify phase)
29 | # 4. Publishes artifacts via Nexus (deploy phase)
30 | mvn -B clean deploy \
31 | -Dcheckstyle.skip \
32 | -DskipTests \
33 | -Prelease \
34 | --settings .github/resources/settings.xml
35 |
36 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | # Copyright 2020 Google Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | name: Continuous Integration
15 |
16 | on: pull_request
17 |
18 | jobs:
19 | build:
20 | runs-on: ubuntu-latest
21 |
22 | strategy:
23 | matrix:
24 | java-version: [8, 11, 17]
25 |
26 | steps:
27 | - uses: actions/checkout@v4
28 |
29 | - name: Set up JDK
30 | uses: actions/setup-java@v4
31 | with:
32 | distribution: 'zulu'
33 | java-version: ${{ matrix.java-version }}
34 |
35 | # Does the following:
36 | # 1. Runs the Checkstyle plugin (validate phase)
37 | # 2. Compiles the source (compile phase)
38 | # 3. Runs the unit tests (test phase)
39 | - name: Build with Maven
40 | run: mvn -B clean test
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .idea/
3 | .settings/
4 | *.iml
5 | .classpath
6 | .project
7 | .checkstyle
8 | .factorypath
9 | .vscode/
10 | release.properties
11 | integration_cert.json
12 | integration_apikey.txt
13 | .DS_Store
14 |
--------------------------------------------------------------------------------
/.opensource/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Firebase Admin SDK - Java",
3 | "platforms": [
4 | "Java",
5 | "Admin"
6 | ],
7 | "content": "README.md",
8 | "pages": [],
9 | "related": [
10 | "firebase/firebase-admin-dotnet",
11 | "firebase/firebase-admin-go",
12 | "firebase/firebase-admin-node",
13 | "firebase/firebase-admin-python"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/NOTICE.txt:
--------------------------------------------------------------------------------
1 | Firebase Admin Java SDK
2 | Copyright 2019 Google Inc.
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
6 |
--------------------------------------------------------------------------------
/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Hey there! So you want to contribute to a Firebase SDK?
2 | Before you file this pull request, please read these guidelines:
3 |
4 | ### Discussion
5 |
6 | * Read the contribution guidelines (CONTRIBUTING.md).
7 | * If this has been discussed in an issue, make sure to link to the issue here.
8 | If not, go file an issue about this **before creating a pull request** to discuss.
9 |
10 | ### Testing
11 |
12 | * Make sure all existing tests in the repository pass after your change.
13 | * If you fixed a bug or added a feature, add a new test to cover your code.
14 |
15 | ### API Changes
16 |
17 | * At this time we cannot accept changes that affect the public API. If you'd like to help
18 | us make Firebase APIs better, please propose your change in an issue so that we
19 | can discuss it together.
20 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/FirebaseAppLifecycleListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase;
18 |
19 | /**
20 | * A listener which gets notified when {@link com.google.firebase.FirebaseApp} gets deleted.
21 | */
22 | @Deprecated
23 | interface FirebaseAppLifecycleListener {
24 |
25 | /**
26 | * Gets called when {@link FirebaseApp#delete()} is called. {@link FirebaseApp} public methods
27 | * start throwing after delete is called, so name and options are passed in to be able to identify
28 | * the instance.
29 | */
30 | void onDeleted(String firebaseAppName, FirebaseOptions options);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/EmailIdentifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import com.google.firebase.auth.internal.GetAccountInfoRequest;
20 | import com.google.firebase.internal.NonNull;
21 |
22 | /**
23 | * Used for looking up an account by email.
24 | *
25 | * @see {FirebaseAuth#getUsers}
26 | */
27 | public final class EmailIdentifier extends UserIdentifier {
28 | private final String email;
29 |
30 | public EmailIdentifier(@NonNull String email) {
31 | UserRecord.checkEmail(email);
32 | this.email = email;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "EmailIdentifier(" + email + ")";
38 | }
39 |
40 | @Override
41 | void populate(@NonNull GetAccountInfoRequest payload) {
42 | payload.addEmail(email);
43 | }
44 |
45 | @Override
46 | boolean matches(@NonNull UserRecord userRecord) {
47 | return email.equals(userRecord.getEmail());
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/ErrorInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import java.util.List;
20 |
21 | /**
22 | * Represents an error encountered while importing an {@link ImportUserRecord}.
23 | */
24 | public final class ErrorInfo {
25 |
26 | private final int index;
27 | private final String reason;
28 |
29 | ErrorInfo(int index, String reason) {
30 | this.index = index;
31 | this.reason = reason;
32 | }
33 |
34 | /**
35 | * The index of the failed user in the list passed to the
36 | * {@link FirebaseAuth#importUsersAsync(List, UserImportOptions)} method.
37 | *
38 | * @return an integer index.
39 | */
40 | public int getIndex() {
41 | return index;
42 | }
43 |
44 | /**
45 | * A string describing the error.
46 | *
47 | * @return A string error message.
48 | */
49 | public String getReason() {
50 | return reason;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/FirebaseAuthException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import com.google.firebase.ErrorCode;
20 | import com.google.firebase.FirebaseException;
21 | import com.google.firebase.IncomingHttpResponse;
22 | import com.google.firebase.internal.NonNull;
23 | import com.google.firebase.internal.Nullable;
24 |
25 | /**
26 | * Generic exception related to Firebase Authentication. Check the error code and message for more
27 | * details.
28 | */
29 | public class FirebaseAuthException extends FirebaseException {
30 |
31 | private final AuthErrorCode errorCode;
32 |
33 | public FirebaseAuthException(
34 | @NonNull ErrorCode errorCode,
35 | @NonNull String message,
36 | Throwable cause,
37 | IncomingHttpResponse response,
38 | AuthErrorCode authErrorCode) {
39 | super(errorCode, message, cause, response);
40 | this.errorCode = authErrorCode;
41 | }
42 |
43 | public FirebaseAuthException(FirebaseException base) {
44 | this(base.getErrorCode(), base.getMessage(), base.getCause(), base.getHttpResponse(), null);
45 | }
46 |
47 | @Nullable
48 | public AuthErrorCode getAuthErrorCode() {
49 | return errorCode;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/FirebaseTokenVerifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | /**
20 | * An interface for verifying Firebase token strings. Exists mainly to facilitate easy testing
21 | * and extension/decoration of the token verification functionality.
22 | */
23 | interface FirebaseTokenVerifier {
24 |
25 | /**
26 | * Verifies that the given token string is a valid Firebase JWT.
27 | *
28 | * @param token The token string to be verified.
29 | * @return A decoded representation of the input token string.
30 | * @throws FirebaseAuthException If the input token string fails to verify due to any reason.
31 | */
32 | FirebaseToken verifyToken(String token) throws FirebaseAuthException;
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/GetUsersResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import static com.google.common.base.Preconditions.checkNotNull;
20 |
21 | import com.google.firebase.internal.NonNull;
22 | import java.util.Set;
23 |
24 | /**
25 | * Represents the result of the {@link FirebaseAuth#getUsersAsync(Collection)} API.
26 | */
27 | public final class GetUsersResult {
28 | private final Set users;
29 | private final Set notFound;
30 |
31 | GetUsersResult(@NonNull Set users, @NonNull Set notFound) {
32 | this.users = checkNotNull(users);
33 | this.notFound = checkNotNull(notFound);
34 | }
35 |
36 | /**
37 | * Set of user records corresponding to the set of users that were requested. Only users
38 | * that were found are listed here. The result set is unordered.
39 | */
40 | @NonNull
41 | public Set getUsers() {
42 | return this.users;
43 | }
44 |
45 | /**
46 | * Set of identifiers that were requested, but not found.
47 | */
48 | @NonNull
49 | public Set getNotFound() {
50 | return this.notFound;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/PhoneIdentifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import com.google.firebase.auth.internal.GetAccountInfoRequest;
20 | import com.google.firebase.internal.NonNull;
21 |
22 | /**
23 | * Used for looking up an account by phone number.
24 | *
25 | * @see {FirebaseAuth#getUsers}
26 | */
27 | public final class PhoneIdentifier extends UserIdentifier {
28 | private final String phoneNumber;
29 |
30 | public PhoneIdentifier(@NonNull String phoneNumber) {
31 | UserRecord.checkPhoneNumber(phoneNumber);
32 | this.phoneNumber = phoneNumber;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "PhoneIdentifier(" + phoneNumber + ")";
38 | }
39 |
40 | @Override
41 | void populate(@NonNull GetAccountInfoRequest payload) {
42 | payload.addPhoneNumber(phoneNumber);
43 | }
44 |
45 | @Override
46 | boolean matches(@NonNull UserRecord userRecord) {
47 | return phoneNumber.equals(userRecord.getPhoneNumber());
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/ProviderIdentifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import com.google.firebase.auth.internal.GetAccountInfoRequest;
20 | import com.google.firebase.internal.NonNull;
21 |
22 | /**
23 | * Used for looking up an account by provider.
24 | *
25 | * @see {FirebaseAuth#getUsers}
26 | */
27 | public final class ProviderIdentifier extends UserIdentifier {
28 | private final String providerId;
29 | private final String providerUid;
30 |
31 | public ProviderIdentifier(@NonNull String providerId, @NonNull String providerUid) {
32 | UserRecord.checkProvider(providerId, providerUid);
33 | this.providerId = providerId;
34 | this.providerUid = providerUid;
35 | }
36 |
37 | @Override
38 | public String toString() {
39 | return "ProviderIdentifier(" + providerId + ", " + providerUid + ")";
40 | }
41 |
42 | @Override
43 | void populate(@NonNull GetAccountInfoRequest payload) {
44 | payload.addFederatedUserId(providerId, providerUid);
45 | }
46 |
47 | @Override
48 | boolean matches(@NonNull UserRecord userRecord) {
49 | for (UserInfo userInfo : userRecord.getProviderData()) {
50 | if (providerId.equals(userInfo.getProviderId()) && providerUid.equals(userInfo.getUid())) {
51 | return true;
52 | }
53 | }
54 | return false;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/UidIdentifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import com.google.firebase.auth.internal.GetAccountInfoRequest;
20 | import com.google.firebase.internal.NonNull;
21 |
22 | /**
23 | * Used for looking up an account by uid.
24 | *
25 | * @see {FirebaseAuth#getUsers}
26 | */
27 | public final class UidIdentifier extends UserIdentifier {
28 | private final String uid;
29 |
30 | public UidIdentifier(@NonNull String uid) {
31 | UserRecord.checkUid(uid);
32 | this.uid = uid;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "UidIdentifier(" + uid + ")";
38 | }
39 |
40 | @Override
41 | void populate(@NonNull GetAccountInfoRequest payload) {
42 | payload.addUid(uid);
43 | }
44 |
45 | @Override
46 | boolean matches(@NonNull UserRecord userRecord) {
47 | return uid.equals(userRecord.getUid());
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/UserIdentifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth;
18 |
19 | import com.google.firebase.auth.internal.GetAccountInfoRequest;
20 | import com.google.firebase.internal.NonNull;
21 |
22 | /**
23 | * Identifies a user to be looked up.
24 | */
25 | public abstract class UserIdentifier {
26 | public abstract String toString();
27 |
28 | abstract void populate(@NonNull GetAccountInfoRequest payload);
29 |
30 | abstract boolean matches(@NonNull UserRecord userRecord);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Bcrypt.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | import com.google.common.collect.ImmutableMap;
20 | import com.google.firebase.auth.UserImportHash;
21 | import java.util.Map;
22 |
23 | /**
24 | * Represents the Bcrypt password hashing algorithm. Can be used as an instance of
25 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
26 | */
27 | public final class Bcrypt extends UserImportHash {
28 |
29 | private Bcrypt() {
30 | super("BCRYPT");
31 | }
32 |
33 | public static Bcrypt getInstance() {
34 | return new Bcrypt();
35 | }
36 |
37 | @Override
38 | protected Map getOptions() {
39 | return ImmutableMap.of();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Hmac.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | import static com.google.common.base.Preconditions.checkArgument;
20 |
21 | import com.google.common.collect.ImmutableMap;
22 | import com.google.common.io.BaseEncoding;
23 | import com.google.firebase.auth.UserImportHash;
24 | import java.util.Map;
25 |
26 | abstract class Hmac extends UserImportHash {
27 |
28 | private final String key;
29 |
30 | Hmac(String name, Builder builder) {
31 | super(name);
32 | checkArgument(builder.key != null && builder.key.length > 0,
33 | "A non-empty key is required for HMAC algorithms");
34 | this.key = BaseEncoding.base64().encode(builder.key);
35 | }
36 |
37 | @Override
38 | protected final Map getOptions() {
39 | return ImmutableMap.of("signerKey", key);
40 | }
41 |
42 | abstract static class Builder {
43 | private byte[] key;
44 |
45 | protected abstract T getInstance();
46 |
47 | /**
48 | * Sets the signer key for the HMAC hash algorithm. Required field.
49 | *
50 | * @param key Signer key as a byte array.
51 | * @return This builder.
52 | */
53 | public T setKey(byte[] key) {
54 | this.key = key;
55 | return getInstance();
56 | }
57 |
58 | public abstract U build();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/HmacMd5.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the HMAC MD5 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class HmacMd5 extends Hmac {
24 |
25 | private HmacMd5(Builder builder) {
26 | super("HMAC_MD5", builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends Hmac.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public HmacMd5 build() {
43 | return new HmacMd5(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/HmacSha1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the HMAC SHA1 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class HmacSha1 extends Hmac {
24 |
25 | private HmacSha1(Builder builder) {
26 | super("HMAC_SHA1", builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends Hmac.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public HmacSha1 build() {
43 | return new HmacSha1(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/HmacSha256.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the HMAC SHA256 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class HmacSha256 extends Hmac {
24 |
25 | private HmacSha256(Builder builder) {
26 | super("HMAC_SHA256", builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends Hmac.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public HmacSha256 build() {
43 | return new HmacSha256(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/HmacSha512.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the HMAC SHA512 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class HmacSha512 extends Hmac {
24 |
25 | private HmacSha512(Builder builder) {
26 | super("HMAC_SHA512", builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends Hmac.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public HmacSha512 build() {
43 | return new HmacSha512(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Md5.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the MD5 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class Md5 extends RepeatableHash {
24 |
25 | private Md5(Builder builder) {
26 | super("MD5", 0, 8192, builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends RepeatableHash.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public Md5 build() {
43 | return new Md5(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Pbkdf2Sha256.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the PBKDF2 SHA256 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class Pbkdf2Sha256 extends RepeatableHash {
24 |
25 | private Pbkdf2Sha256(Builder builder) {
26 | super("PBKDF2_SHA256", 0, 120000, builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends RepeatableHash.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public Pbkdf2Sha256 build() {
43 | return new Pbkdf2Sha256(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/PbkdfSha1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the PBKDF SHA1 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class PbkdfSha1 extends RepeatableHash {
24 |
25 | private PbkdfSha1(Builder builder) {
26 | super("PBKDF_SHA1", 0, 120000, builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends RepeatableHash.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public PbkdfSha1 build() {
43 | return new PbkdfSha1(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Sha1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the SHA1 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class Sha1 extends RepeatableHash {
24 |
25 | private Sha1(Builder builder) {
26 | super("SHA1", 1, 8192, builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends RepeatableHash.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public Sha1 build() {
43 | return new Sha1(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Sha256.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the SHA256 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class Sha256 extends RepeatableHash {
24 |
25 | private Sha256(Builder builder) {
26 | super("SHA256", 1, 8192, builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends RepeatableHash.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public Sha256 build() {
43 | return new Sha256(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/hash/Sha512.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.hash;
18 |
19 | /**
20 | * Represents the SHA512 password hashing algorithm. Can be used as an instance of
21 | * {@link com.google.firebase.auth.UserImportHash} when importing users.
22 | */
23 | public final class Sha512 extends RepeatableHash {
24 |
25 | private Sha512(Builder builder) {
26 | super("SHA512", 1, 8192, builder);
27 | }
28 |
29 | public static Builder builder() {
30 | return new Builder();
31 | }
32 |
33 | public static class Builder extends RepeatableHash.Builder {
34 |
35 | private Builder() {}
36 |
37 | @Override
38 | protected Builder getInstance() {
39 | return this;
40 | }
41 |
42 | public Sha512 build() {
43 | return new Sha512(this);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/BatchDeleteResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.api.client.util.Key;
20 | import java.util.List;
21 |
22 | /**
23 | * Represents the response from Google identity Toolkit for a batch delete request.
24 | */
25 | public class BatchDeleteResponse {
26 |
27 | @Key("errors")
28 | private List errors;
29 |
30 | public List getErrors() {
31 | return errors;
32 | }
33 |
34 | public static class ErrorInfo {
35 | @Key("index")
36 | private int index;
37 |
38 | @Key("message")
39 | private String message;
40 |
41 | // A 'localId' field also exists here, but is not currently exposed in the Admin SDK.
42 |
43 | public int getIndex() {
44 | return index;
45 | }
46 |
47 | public String getMessage() {
48 | return message;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/CryptoSigner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.firebase.auth.FirebaseAuthException;
20 | import com.google.firebase.internal.NonNull;
21 | import java.io.IOException;
22 |
23 | /**
24 | * Represents an object that can be used to cryptographically sign data. Mainly used for signing
25 | * custom JWT tokens issued to Firebase users.
26 | *
27 | *
See {@link com.google.firebase.auth.FirebaseAuth#createCustomToken(String)}.
28 | */
29 | interface CryptoSigner {
30 |
31 | /**
32 | * Signs the given payload.
33 | *
34 | * @param payload Data to be signed
35 | * @return Signature as a byte array
36 | * @throws FirebaseAuthException If an error occurs during signing
37 | */
38 | @NonNull
39 | byte[] sign(@NonNull byte[] payload) throws FirebaseAuthException;
40 |
41 | /**
42 | * Returns the client email of the service account used to sign payloads.
43 | *
44 | * @return A service account client email
45 | */
46 | @NonNull
47 | String getAccount();
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/DownloadAccountResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.api.client.util.Key;
20 | import java.util.List;
21 |
22 | /**
23 | * JSON data binding for downloadAccountResponse messages sent by Google identity toolkit service.
24 | */
25 | public class DownloadAccountResponse {
26 |
27 | @Key("users")
28 | private List users;
29 |
30 | @Key("nextPageToken")
31 | private String pageToken;
32 |
33 | public List getUsers() {
34 | return users;
35 | }
36 |
37 | public boolean hasUsers() {
38 | return users != null && !users.isEmpty();
39 | }
40 |
41 | public String getPageToken() {
42 | return pageToken;
43 | }
44 |
45 | /**
46 | * JSON data binding for exported user records.
47 | */
48 | public static final class User extends GetAccountInfoResponse.User {
49 |
50 | @Key("passwordHash")
51 | private String passwordHash;
52 |
53 | @Key("salt")
54 | private String passwordSalt;
55 |
56 | public String getPasswordHash() {
57 | return passwordHash;
58 | }
59 |
60 | public String getPasswordSalt() {
61 | return passwordSalt;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/ListProviderConfigsResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.firebase.auth.ProviderConfig;
20 | import java.util.List;
21 |
22 | /**
23 | * Interface for config list response messages sent by Google identity toolkit service.
24 | */
25 | public interface ListProviderConfigsResponse {
26 |
27 | public List getProviderConfigs();
28 |
29 | public boolean hasProviderConfigs();
30 |
31 | public String getPageToken();
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/ListTenantsResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.api.client.util.Key;
20 | import com.google.common.annotations.VisibleForTesting;
21 | import com.google.common.collect.ImmutableList;
22 | import com.google.firebase.auth.multitenancy.Tenant;
23 | import java.util.List;
24 |
25 | /**
26 | * JSON data binding for ListTenantsResponse messages sent by Google identity toolkit service.
27 | */
28 | public final class ListTenantsResponse {
29 |
30 | @Key("tenants")
31 | private List tenants;
32 |
33 | @Key("pageToken")
34 | private String pageToken;
35 |
36 | @VisibleForTesting
37 | public ListTenantsResponse(List tenants, String pageToken) {
38 | this.tenants = tenants;
39 | this.pageToken = pageToken;
40 | }
41 |
42 | public ListTenantsResponse() { }
43 |
44 | public List getTenants() {
45 | return tenants == null ? ImmutableList.of() : tenants;
46 | }
47 |
48 | public boolean hasTenants() {
49 | return tenants != null && !tenants.isEmpty();
50 | }
51 |
52 | public String getPageToken() {
53 | return pageToken == null ? "" : pageToken;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/UploadAccountResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.api.client.util.Key;
20 | import java.util.List;
21 |
22 | /**
23 | * Represents the response from identity toolkit for a user import request.
24 | */
25 | public class UploadAccountResponse {
26 |
27 | @Key("error")
28 | private List errors;
29 |
30 | public List getErrors() {
31 | return errors;
32 | }
33 |
34 | public static class ErrorInfo {
35 | @Key("index")
36 | private int index;
37 |
38 | @Key("message")
39 | private String message;
40 |
41 | public int getIndex() {
42 | return index;
43 | }
44 |
45 | public String getMessage() {
46 | return message;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.auth.internal;
18 |
19 | import com.google.common.annotations.VisibleForTesting;
20 | import com.google.common.base.Strings;
21 | import com.google.firebase.internal.FirebaseProcessEnvironment;
22 |
23 | public class Utils {
24 | @VisibleForTesting
25 | public static final String AUTH_EMULATOR_HOST = "FIREBASE_AUTH_EMULATOR_HOST";
26 |
27 | public static boolean isEmulatorMode() {
28 | return !Strings.isNullOrEmpty(getEmulatorHost());
29 | }
30 |
31 | public static String getEmulatorHost() {
32 | return FirebaseProcessEnvironment.getenv(AUTH_EMULATOR_HOST);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/auth/internal/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * @hide
19 | */
20 | package com.google.firebase.auth.internal;
21 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/DatabaseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | /**
20 | * This error is thrown when the Firebase Database library is unable to operate on the input it has
21 | * been given.
22 | */
23 | public class DatabaseException extends RuntimeException {
24 |
25 | /**
26 | * For internal use
27 | *
28 | * @hide
29 | * @param message A human readable description of the error
30 | */
31 | public DatabaseException(String message) {
32 | super(message);
33 | }
34 |
35 | /**
36 | * For internal use
37 | *
38 | * @hide
39 | * @param message A human readable description of the error
40 | * @param cause The underlying cause for this error
41 | */
42 | public DatabaseException(String message, Throwable cause) {
43 | super(message, cause);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/Exclude.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /** Marks a field as excluded from the Database. */
25 | @Retention(RetentionPolicy.RUNTIME)
26 | @Target({ElementType.METHOD, ElementType.FIELD})
27 | public @interface Exclude {}
28 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/IgnoreExtraProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Properties that don't map to class fields are ignored when serializing to a class annotated with
26 | * this annotation.
27 | */
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Target({ElementType.TYPE})
30 | public @interface IgnoreExtraProperties {}
31 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/PropertyName.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /** Marks a field to be renamed when serialized. */
25 | @Retention(RetentionPolicy.RUNTIME)
26 | @Target({ElementType.METHOD, ElementType.FIELD})
27 | public @interface PropertyName {
28 |
29 | String value();
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/ServerValue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | // Server values
20 |
21 | import com.google.firebase.database.core.ServerValues;
22 |
23 | import java.util.Collections;
24 | import java.util.HashMap;
25 | import java.util.Map;
26 |
27 | /** Contains placeholder values to use when writing data to the Firebase Database. */
28 | public class ServerValue {
29 |
30 | /**
31 | * A placeholder value for auto-populating the current timestamp (time since the Unix epoch, in
32 | * milliseconds) by the Firebase Database servers.
33 | */
34 | public static final Map TIMESTAMP = createServerValuePlaceholder("timestamp");
35 |
36 | private static Map createServerValuePlaceholder(String key) {
37 | Map result = new HashMap<>();
38 | result.put(ServerValues.NAME_SUBKEY_SERVERVALUE, key);
39 | return Collections.unmodifiableMap(result);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/ThrowOnExtraProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Properties that don't map to class fields when serializing to a class annotated with this
26 | * annotation cause an exception to be thrown.
27 | */
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Target({ElementType.TYPE})
30 | public @interface ThrowOnExtraProperties {}
31 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/ValueEventListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database;
18 |
19 | /**
20 | * Classes implementing this interface can be used to receive events about data changes at a
21 | * location. Attach the listener to a location user {@link
22 | * DatabaseReference#addValueEventListener(ValueEventListener)}.
23 | */
24 | public interface ValueEventListener {
25 |
26 | /**
27 | * This method will be called with a snapshot of the data at this location. It will also be called
28 | * each time that data changes.
29 | *
30 | * @param snapshot The current data at the location
31 | */
32 | void onDataChange(DataSnapshot snapshot);
33 |
34 | /**
35 | * This method will be triggered in the event that this listener either failed at the server, or
36 | * is removed as a result of the security and Firebase Database rules. For more information on
37 | * securing your data, see:
38 | *
39 | * Security Quickstart
40 | *
41 | * @param error A description of the error that occurred
42 | */
43 | void onCancelled(DatabaseError error);
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/annotations/NotNull.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.annotations;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * An element annotated with this class indicates that it cannot be null. This is used by lint tools
26 | * to ensure callers properly check for null values before sending values as parameters. It can also
27 | * be used on return values to indicate to the caller that the return cannot be null so therefore no
28 | * null checks need to be made.
29 | */
30 | @Retention(RetentionPolicy.CLASS)
31 | @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
32 | public @interface NotNull {
33 |
34 | String value() default "";
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/annotations/Nullable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.annotations;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * An element annotated with this class indicates that it can be null. This is used by lint tools to
26 | * inform callers that they may send in null values as parameters. It can also be used on return
27 | * values to indicate to the caller that he or she must check for null.
28 | */
29 | @Retention(RetentionPolicy.CLASS)
30 | @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
31 | public @interface Nullable {
32 |
33 | String value() default "";
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/annotations/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * @hide
19 | */
20 | package com.google.firebase.database.annotations;
21 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/collection/LLRBBlackValueNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.collection;
18 |
19 | public class LLRBBlackValueNode extends LLRBValueNode {
20 |
21 | LLRBBlackValueNode(K key, V value, LLRBNode left, LLRBNode right) {
22 | super(key, value, left, right);
23 | }
24 |
25 | @Override
26 | protected Color getColor() {
27 | return Color.BLACK;
28 | }
29 |
30 | @Override
31 | public boolean isRed() {
32 | return false;
33 | }
34 |
35 | @Override
36 | protected LLRBValueNode copy(K key, V value, LLRBNode left, LLRBNode right) {
37 | K newKey = key == null ? this.getKey() : key;
38 | V newValue = value == null ? this.getValue() : value;
39 | LLRBNode newLeft = left == null ? this.getLeft() : left;
40 | LLRBNode newRight = right == null ? this.getRight() : right;
41 | return new LLRBBlackValueNode<>(newKey, newValue, newLeft, newRight);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/collection/LLRBRedValueNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.collection;
18 |
19 | import static com.google.firebase.database.collection.LLRBNode.Color.RED;
20 |
21 | public class LLRBRedValueNode extends LLRBValueNode {
22 |
23 | LLRBRedValueNode(K key, V value) {
24 | super(key, value, LLRBEmptyNode.getInstance(), LLRBEmptyNode.getInstance());
25 | }
26 |
27 | LLRBRedValueNode(K key, V value, LLRBNode left, LLRBNode right) {
28 | super(key, value, left, right);
29 | }
30 |
31 | @Override
32 | protected Color getColor() {
33 | return RED;
34 | }
35 |
36 | @Override
37 | public boolean isRed() {
38 | return true;
39 | }
40 |
41 | @Override
42 | protected LLRBValueNode copy(K key, V value, LLRBNode left, LLRBNode right) {
43 | K newKey = key == null ? this.getKey() : key;
44 | V newValue = value == null ? this.getValue() : value;
45 | LLRBNode newLeft = left == null ? this.getLeft() : left;
46 | LLRBNode newRight = right == null ? this.getRight() : right;
47 | return new LLRBRedValueNode<>(newKey, newValue, newLeft, newRight);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/collection/StandardComparator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.collection;
18 |
19 | import java.util.Comparator;
20 |
21 | public class StandardComparator> implements Comparator {
22 |
23 | private static StandardComparator INSTANCE = new StandardComparator();
24 |
25 | private StandardComparator() {}
26 |
27 | @SuppressWarnings("unchecked")
28 | public static > StandardComparator getComparator(Class clazz) {
29 | return INSTANCE;
30 | }
31 |
32 | @Override
33 | public int compare(A o1, A o2) {
34 | return o1.compareTo(o2);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/collection/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * @hide
19 | */
20 | package com.google.firebase.database.collection;
21 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/connection/CompoundHash.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.connection;
18 |
19 | import java.util.Collections;
20 | import java.util.List;
21 |
22 | public class CompoundHash {
23 |
24 | private final List> posts;
25 | private final List hashes;
26 |
27 | public CompoundHash(List> posts, List hashes) {
28 | if (posts.size() != hashes.size() - 1) {
29 | throw new IllegalArgumentException(
30 | "Number of posts need to be n-1 for n hashes in " + "CompoundHash");
31 | }
32 | this.posts = posts;
33 | this.hashes = hashes;
34 | }
35 |
36 | public List> getPosts() {
37 | return Collections.unmodifiableList(this.posts);
38 | }
39 |
40 | public List getHashes() {
41 | return Collections.unmodifiableList(this.hashes);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/google/firebase/database/connection/ConnectionAuthTokenProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.firebase.database.connection;
18 |
19 | public interface ConnectionAuthTokenProvider {
20 |
21 | /**
22 | * Gets the token that should currently be used for authenticated requests.
23 | *
24 | * @param forceRefresh Pass true to get a new, up-to-date token rather than a (potentially
25 | * expired) cached token.
26 | * @param callback Callback to be notified after operation completes.
27 | */
28 | void getToken(boolean forceRefresh, GetTokenCallback callback);
29 |
30 | interface GetTokenCallback {
31 |
32 | /**
33 | * Called if the getToken operation completed successfully. Token may be null if there is no
34 | * auth state currently.
35 | */
36 | void onSuccess(String token);
37 |
38 | /**
39 | * Called if the getToken operation fails.
40 | *
41 | *