Skip to content

Commit 39c7483

Browse files
Merge branch 'master' into ssrc
2 parents 3a9fa4a + 450fe3c commit 39c7483

File tree

9 files changed

+79
-26
lines changed

9 files changed

+79
-26
lines changed

.github/resources/settings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
<servers>
99
<server>
10-
<id>ossrh</id>
11-
<username>${env.NEXUS_OSSRH_USERNAME}</username>
12-
<password>${env.NEXUS_OSSRH_PASSWORD}</password>
10+
<id>central</id>
11+
<username>${env.CENTRAL_USERNAME}</username>
12+
<password>${env.CENTRAL_TOKEN}</password>
1313
</server>
1414
</servers>
1515

.github/scripts/publish_artifacts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ gpg --import --no-tty --batch --yes firebase.asc
2626
# 1. Compiles the source (compile phase)
2727
# 2. Packages the artifacts - src, bin, javadocs (package phase)
2828
# 3. Signs the artifacts (verify phase)
29-
# 4. Publishes artifacts via Nexus (deploy phase)
29+
# 4. Publishes artifacts via Central Publisher Portal (deploy phase)
3030
mvn -B clean deploy \
3131
-Dcheckstyle.skip \
3232
-DskipTests \

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ jobs:
100100
env:
101101
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
102102
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
103-
NEXUS_OSSRH_USERNAME: ${{ secrets.NEXUS_OSSRH_USERNAME }}
104-
NEXUS_OSSRH_PASSWORD: ${{ secrets.NEXUS_OSSRH_PASSWORD }}
103+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
104+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
105105

106106
# See: https://cli.github.com/manual/gh_release_create
107107
- name: Create release tag

pom.xml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<groupId>com.google.firebase</groupId>
2121
<artifactId>firebase-admin</artifactId>
22-
<version>9.5.0</version>
22+
<version>9.6.0</version>
2323
<packaging>jar</packaging>
2424

2525
<name>firebase-admin</name>
@@ -59,7 +59,7 @@
5959
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6060
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
6161
<skipUTs>${skipTests}</skipUTs>
62-
<netty.version>4.2.3.Final</netty.version>
62+
<netty.version>4.2.5.Final</netty.version>
6363
</properties>
6464

6565
<scm>
@@ -69,13 +69,6 @@
6969
<tag>HEAD</tag>
7070
</scm>
7171

72-
<distributionManagement>
73-
<snapshotRepository>
74-
<id>ossrh</id>
75-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
76-
</snapshotRepository>
77-
</distributionManagement>
78-
7972
<profiles>
8073
<profile>
8174
<id>devsite-apidocs</id>
@@ -89,7 +82,7 @@
8982
<plugin>
9083
<!-- Generate API docs using Doclava for the developer site -->
9184
<artifactId>maven-javadoc-plugin</artifactId>
92-
<version>3.11.2</version>
85+
<version>3.11.3</version>
9386
<executions>
9487
<execution>
9588
<phase>site</phase>
@@ -301,7 +294,7 @@
301294
</plugin>
302295
<plugin>
303296
<artifactId>maven-javadoc-plugin</artifactId>
304-
<version>3.11.2</version>
297+
<version>3.11.3</version>
305298
<executions>
306299
<execution>
307300
<id>attach-javadocs</id>
@@ -350,14 +343,14 @@
350343

351344
<!-- Deploy Phase -->
352345
<plugin>
353-
<groupId>org.sonatype.plugins</groupId>
354-
<artifactId>nexus-staging-maven-plugin</artifactId>
355-
<version>1.7.0</version>
346+
<groupId>org.sonatype.central</groupId>
347+
<artifactId>central-publishing-maven-plugin</artifactId>
348+
<version>0.8.0</version>
356349
<extensions>true</extensions>
357350
<configuration>
358-
<serverId>ossrh</serverId>
359-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
360-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
351+
<publishingServerId>central</publishingServerId>
352+
<autoPublish>true</autoPublish>
353+
<waitUntil>published</waitUntil>
361354
</configuration>
362355
</plugin>
363356
</plugins>
@@ -385,7 +378,7 @@
385378
<dependency>
386379
<groupId>com.google.cloud</groupId>
387380
<artifactId>libraries-bom</artifactId>
388-
<version>26.65.0</version>
381+
<version>26.67.0</version>
389382
<type>pom</type>
390383
<scope>import</scope>
391384
</dependency>

src/main/java/com/google/firebase/auth/ActionCodeSettings.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ private ActionCodeSettings(Builder builder) {
5151
if (!Strings.isNullOrEmpty(builder.dynamicLinkDomain)) {
5252
properties.put("dynamicLinkDomain", builder.dynamicLinkDomain);
5353
}
54+
if (!Strings.isNullOrEmpty(builder.linkDomain)) {
55+
properties.put("linkDomain", builder.linkDomain);
56+
}
5457
if (!Strings.isNullOrEmpty(builder.iosBundleId)) {
5558
properties.put("iOSBundleId", builder.iosBundleId);
5659
}
@@ -84,6 +87,7 @@ public static final class Builder {
8487
private String url;
8588
private boolean handleCodeInApp;
8689
private String dynamicLinkDomain;
90+
private String linkDomain;
8791
private String iosBundleId;
8892
private String androidPackageName;
8993
private String androidMinimumVersion;
@@ -135,12 +139,28 @@ public Builder setHandleCodeInApp(boolean handleCodeInApp) {
135139
*
136140
* @param dynamicLinkDomain Firebase Dynamic Link domain string.
137141
* @return This builder.
142+
* @deprecated Use {@link #setLinkDomain(String)} instead.
138143
*/
144+
@Deprecated
139145
public Builder setDynamicLinkDomain(String dynamicLinkDomain) {
140146
this.dynamicLinkDomain = dynamicLinkDomain;
141147
return this;
142148
}
143149

150+
/**
151+
* Sets the link domain to use for the current link if it is to be opened using
152+
* {@code handleCodeInApp}, as multiple link domains can be configured per project. This
153+
* setting provides the ability to explicitly choose one. If none is provided, the default
154+
* Firebase Hosting domain will be used.
155+
*
156+
* @param linkDomain Link domain string.
157+
* @return This builder.
158+
*/
159+
public Builder setLinkDomain(String linkDomain) {
160+
this.linkDomain = linkDomain;
161+
return this;
162+
}
163+
144164
/**
145165
* Sets the bundle ID of the iOS app where the link should be handled if the
146166
* application is already installed on the device.

src/main/java/com/google/firebase/auth/AuthErrorCode.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public enum AuthErrorCode {
5858
*/
5959
INVALID_DYNAMIC_LINK_DOMAIN,
6060

61+
/**
62+
* The provided hosting link domain is not configured or authorized for the current project.
63+
*/
64+
INVALID_HOSTING_LINK_DOMAIN,
65+
6166
/**
6267
* The specified ID token is invalid.
6368
*/

src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ final class AuthErrorHandler extends AbstractHttpErrorHandler<FirebaseAuthExcept
7373
"The provided dynamic link domain is not "
7474
+ "configured or authorized for the current project",
7575
AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN))
76+
.put(
77+
"INVALID_HOSTING_LINK_DOMAIN",
78+
new AuthError(
79+
ErrorCode.INVALID_ARGUMENT,
80+
"The provided hosting link domain is not configured in Firebase Hosting or is "
81+
+ "not owned by the current project",
82+
AuthErrorCode.INVALID_HOSTING_LINK_DOMAIN))
7683
.put(
7784
"PHONE_NUMBER_EXISTS",
7885
new AuthError(
@@ -180,7 +187,7 @@ String buildMessage(AuthServiceErrorResponse response) {
180187

181188
/**
182189
* JSON data binding for JSON error messages sent by Google identity toolkit service. These
183-
* error messages take the form `{"error": {"message": "CODE: OPTIONAL DETAILS"}}`.
190+
* error messages take the form `{"error": {"message": "CODE : OPTIONAL DETAILS"}}`.
184191
*/
185192
private static class AuthServiceErrorResponse {
186193

@@ -196,7 +203,7 @@ public String getCode() {
196203

197204
int separator = message.indexOf(':');
198205
if (separator != -1) {
199-
return message.substring(0, separator);
206+
return message.substring(0, separator).trim();
200207
}
201208

202209
return message;

src/test/java/com/google/firebase/auth/ActionCodeSettingsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public void testAllSettings() {
6868
.setUrl("https://example.com")
6969
.setHandleCodeInApp(true)
7070
.setDynamicLinkDomain("myapp.page.link")
71+
.setLinkDomain("myapp.custom.link")
7172
.setIosBundleId("com.example.ios")
7273
.setAndroidPackageName("com.example.android")
7374
.setAndroidMinimumVersion("6.0")
@@ -77,6 +78,7 @@ public void testAllSettings() {
7778
.put("continueUrl", "https://example.com")
7879
.put("canHandleCodeInApp", true)
7980
.put("dynamicLinkDomain", "myapp.page.link")
81+
.put("linkDomain", "myapp.custom.link")
8082
.put("iOSBundleId", "com.example.ios")
8183
.put("androidPackageName", "com.example.android")
8284
.put("androidMinimumVersion", "6.0")

src/test/java/com/google/firebase/auth/FirebaseAuthIT.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class FirebaseAuthIT {
8282
private static final JsonFactory jsonFactory = ApiClientUtils.getDefaultJsonFactory();
8383
private static final HttpTransport transport = ApiClientUtils.getDefaultTransport();
8484
private static final String ACTION_LINK_CONTINUE_URL = "http://localhost/?a=1&b=2#c=3";
85+
private static final String INVALID_ACTION_LINK_CONTINUE_URL = "http://www.localhost/?a=1&b=2#c=3";
8586

8687
private static final FirebaseAuth auth = FirebaseAuth.getInstance(
8788
IntegrationTestUtils.ensureDefaultApp());
@@ -868,6 +869,31 @@ public void testGenerateSignInWithEmailLink() throws Exception {
868869
assertTrue(auth.getUser(user.getUid()).isEmailVerified());
869870
}
870871

872+
@Test
873+
public void testAuthErrorCodeParse() throws Exception {
874+
RandomUser user = UserTestUtils.generateRandomUserInfo();
875+
temporaryUser.create(new UserRecord.CreateRequest()
876+
.setUid(user.getUid())
877+
.setEmail(user.getEmail())
878+
.setEmailVerified(false)
879+
.setPassword("password"));
880+
try {
881+
auth.generateSignInWithEmailLink(user.getEmail(), ActionCodeSettings.builder()
882+
.setUrl(INVALID_ACTION_LINK_CONTINUE_URL)
883+
.build());
884+
fail("No error thrown for invlaid custom hosting domain");
885+
} catch (FirebaseAuthException e) {
886+
assertEquals(
887+
"The domain of the continue URL is not whitelisted (UNAUTHORIZED_DOMAIN): Domain not "
888+
+ "allowlisted by project",
889+
e.getMessage());
890+
assertEquals(ErrorCode.INVALID_ARGUMENT, e.getErrorCode());
891+
assertNotNull(e.getCause());
892+
assertNotNull(e.getHttpResponse());
893+
assertEquals(AuthErrorCode.UNAUTHORIZED_CONTINUE_URL, e.getAuthErrorCode());
894+
}
895+
}
896+
871897
@Test
872898
public void testOidcProviderConfigLifecycle() throws Exception {
873899
// Create provider config

0 commit comments

Comments
 (0)