Skip to content

Commit b8bfc49

Browse files
committed
Address PR feedback
1 parent 1a3009b commit b8bfc49

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/main/java/com/google/firebase/appcheck/AppCheckErrorCode.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,5 @@ public enum AppCheckErrorCode {
2929
/**
3030
* Internal server error.
3131
*/
32-
INTERNAL,
33-
34-
/**
35-
* User is not authenticated.
36-
*/
37-
UNAUTHENTICATED,
32+
INTERNAL
3833
}

src/main/java/com/google/firebase/appcheck/AppCheckTokenVerifier.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private AppCheckTokenVerifier(Builder builder) {
6868
DecodedAppCheckToken verifyToken(String token) throws FirebaseAppCheckException {
6969
SignedJWT signedJWT;
7070
JWTClaimsSet claimsSet;
71-
String scopedProjectId = String.format("projects/%s", projectId);
71+
String projectName = String.format("projects/%s", projectId);
7272
String projectIdMatchMessage = " Make sure the App Check token comes from the same "
7373
+ "Firebase project as the service account used to authenticate this SDK.";
7474

@@ -88,10 +88,10 @@ DecodedAppCheckToken verifyToken(String token) throws FirebaseAppCheckException
8888
} else if (!signedJWT.getHeader().getType().getType().equals("JWT")) {
8989
errorMessage = String.format("The provided App Check token has invalid type header."
9090
+ "Expected %s but got %s", "JWT", signedJWT.getHeader().getType().getType());
91-
} else if (!claimsSet.getAudience().contains(scopedProjectId)) {
91+
} else if (!claimsSet.getAudience().contains(projectName)) {
9292
errorMessage = String.format("The provided App Check token has incorrect 'aud' (audience) "
9393
+ "claim. Expected %s but got %s. %s",
94-
scopedProjectId, claimsSet.getAudience().toString(), projectIdMatchMessage);
94+
projectName, claimsSet.getAudience().toString(), projectIdMatchMessage);
9595
} else if (!claimsSet.getIssuer().startsWith(APP_CHECK_ISSUER)) {
9696
errorMessage = "invalid iss";
9797
} else if (claimsSet.getSubject().isEmpty()) {

src/main/java/com/google/firebase/appcheck/DecodedAppCheckToken.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ public String getAudience() {
5252
}
5353

5454
/** Returns the Expiration Time for this token. */
55-
public String getExpirationTime() {
56-
return (String) claims.get("exp");
55+
public Long getExpirationTime() {
56+
return (Long) claims.get("exp");
5757
}
5858

5959
/** Returns the Issued At for this token. */
60-
public String getIssuedAt() {
61-
return (String) claims.get("iat");
60+
public Long getIssuedAt() {
61+
return (Long) claims.get("iat");
6262
}
6363

6464
/** Returns a map of all the claims on this token. */

0 commit comments

Comments
 (0)