Skip to content

Commit 0ce256f

Browse files
author
Yaniv Inbar
committed
api: oauth issue 78: Update to ID Token draft 27
https://codereview.appspot.com/10688043/
1 parent 9b57f9c commit 0ce256f

File tree

2 files changed

+90
-15
lines changed

2 files changed

+90
-15
lines changed

clirr-ignored-differences.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@
9292
<className>com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential</className>
9393
<method>com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential usingOAuth2(android.content.Context, java.lang.String, java.lang.String[])</method>
9494
</difference>
95+
<!-- 7006 (Method Return Type changed): className, method, to (to is just the return type) -->
96+
<difference>
97+
<differenceType>7006</differenceType>
98+
<className>com/google/api/client/googleapis/auth/oauth2/GoogleIdToken$Payload</className>
99+
<method>*</method>
100+
<to>*</to>
101+
</difference>
102+
<!-- 7009 (Method is now Less Accessible): className, method -->
103+
<difference>
104+
<differenceType>7009</differenceType>
105+
<className>com/google/api/client/googleapis/media/MediaHttpUploader</className>
106+
<method>void serverErrorCallback()</method>
107+
</difference>
95108
<!-- 8001 (Class removed): className -->
96109
<difference>
97110
<differenceType>8001</differenceType>

google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleIdToken.java

Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.IOException;
2424
import java.security.GeneralSecurityException;
25+
import java.util.List;
2526

2627
/**
2728
* {@link Beta} <br/>
@@ -85,6 +86,12 @@ public Payload getPayload() {
8586
/**
8687
* {@link Beta} <br/>
8788
* Google ID token payload.
89+
*
90+
* <p>
91+
* Upgrade warning: in prior version 1.15 {@link #getAccessTokenHash()} and
92+
* {@link #setAccessTokenHash(String)} accessed {@code "token_hash"}, but starting with version
93+
* 1.16 they now access {@code "at_hash"}.
94+
* </p>
8895
*/
8996
@Beta
9097
public static class Payload extends IdToken.Payload {
@@ -97,10 +104,6 @@ public static class Payload extends IdToken.Payload {
97104
@Key("cid")
98105
private String issuee;
99106

100-
/** Hash of access token or {@code null} for none. */
101-
@Key("token_hash")
102-
private String accessTokenHash;
103-
104107
/** Hosted domain name if asserted user is a domain managed user or {@code null} for none. */
105108
@Key("hd")
106109
private String hostedDomain;
@@ -138,17 +141,6 @@ public Payload setIssuee(String issuee) {
138141
return this;
139142
}
140143

141-
/** Returns the hash of access token or {@code null} for none. */
142-
public String getAccessTokenHash() {
143-
return accessTokenHash;
144-
}
145-
146-
/** Sets the hash of access token or {@code null} for none. */
147-
public Payload setAccessTokenHash(String accessTokenHash) {
148-
this.accessTokenHash = accessTokenHash;
149-
return this;
150-
}
151-
152144
/**
153145
* Returns the hosted domain name if asserted user is a domain managed user or {@code null} for
154146
* none.
@@ -220,6 +212,76 @@ public Payload setEmailVerified(boolean emailVerified) {
220212
return this;
221213
}
222214

215+
@Override
216+
public Payload setAuthorizationTimeSeconds(Long authorizationTimeSeconds) {
217+
return (Payload) super.setAuthorizationTimeSeconds(authorizationTimeSeconds);
218+
}
219+
220+
@Override
221+
public Payload setAuthorizedParty(String authorizedParty) {
222+
return (Payload) super.setAuthorizedParty(authorizedParty);
223+
}
224+
225+
@Override
226+
public Payload setNonce(String nonce) {
227+
return (Payload) super.setNonce(nonce);
228+
}
229+
230+
@Override
231+
public Payload setAccessTokenHash(String accessTokenHash) {
232+
return (Payload) super.setAccessTokenHash(accessTokenHash);
233+
}
234+
235+
@Override
236+
public Payload setClassReference(String classReference) {
237+
return (Payload) super.setClassReference(classReference);
238+
}
239+
240+
@Override
241+
public Payload setMethodsReferences(List<String> methodsReferences) {
242+
return (Payload) super.setMethodsReferences(methodsReferences);
243+
}
244+
245+
@Override
246+
public Payload setExpirationTimeSeconds(Long expirationTimeSeconds) {
247+
return (Payload) super.setExpirationTimeSeconds(expirationTimeSeconds);
248+
}
249+
250+
@Override
251+
public Payload setNotBeforeTimeSeconds(Long notBeforeTimeSeconds) {
252+
return (Payload) super.setNotBeforeTimeSeconds(notBeforeTimeSeconds);
253+
}
254+
255+
@Override
256+
public Payload setIssuedAtTimeSeconds(Long issuedAtTimeSeconds) {
257+
return (Payload) super.setIssuedAtTimeSeconds(issuedAtTimeSeconds);
258+
}
259+
260+
@Override
261+
public Payload setIssuer(String issuer) {
262+
return (Payload) super.setIssuer(issuer);
263+
}
264+
265+
@Override
266+
public Payload setAudience(Object audience) {
267+
return (Payload) super.setAudience(audience);
268+
}
269+
270+
@Override
271+
public Payload setJwtId(String jwtId) {
272+
return (Payload) super.setJwtId(jwtId);
273+
}
274+
275+
@Override
276+
public Payload setType(String type) {
277+
return (Payload) super.setType(type);
278+
}
279+
280+
@Override
281+
public Payload setSubject(String subject) {
282+
return (Payload) super.setSubject(subject);
283+
}
284+
223285
@Override
224286
public Payload set(String fieldName, Object value) {
225287
return (Payload) super.set(fieldName, value);

0 commit comments

Comments
 (0)