GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add TokenVerifier class that can verify RS256/ES256 tokens by chingor13 · Pull Request #420 · googleapis/google-auth-library-java

This repository was archived by the owner on May 12, 2026. It is now read-only.

Conversation

@chingor13

@chingor13 chingor13 commented Apr 24, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Exposes interface for validating Google signed RS256/ES256 JWT tokens.

This implementation returns a JsonWebSignature instance (from google-http-client) on success and throws a VerificationException on any error.

Usage:

TokenVerifier tokenVerifier = TokenVerifier.newBuilder()
  .setAudience("audience-to-verify")
  .setIssuer("issuer-to-verify")
  .build();
try {
  JsonWebSignature jsonWebSignature = tokenVerifier.verify(tokenString);
  // optionally verify additional claims
  jsonWebSignature
} catch (TokenVerifier.VerificationException e) {
  // invalid token
}

Fixes #85

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chingor13
feat: add TokenVerifier class that can verify RS256/ES256 tokens
282bc14
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 24, 2020
@codecov

codecov Bot commented Apr 24, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #420 into master will increase coverage by 0.36%.
The diff coverage is 83.87%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #420      +/-   ##
============================================
+ Coverage     79.50%   79.86%   +0.36%     
- Complexity      397      409      +12     
============================================
  Files            27       28       +1     
  Lines          1800     1927     +127     
  Branches        186      201      +15     
============================================
+ Hits           1431     1539     +108     
- Misses          269      280      +11     
- Partials        100      108       +8     
Impacted Files Coverage Δ Complexity Δ
...ttp/java/com/google/auth/oauth2/TokenVerifier.java 83.87% <83.87%> (ø) 12.00 <12.00> (?)
...tp/java/com/google/auth/oauth2/UserAuthorizer.java 77.59% <0.00%> (+0.12%) 20.00% <0.00%> (ø%)
...om/google/auth/appengine/AppEngineCredentials.java 75.47% <0.00%> (+0.96%) 16.00% <0.00%> (ø%)
..._http/java/com/google/auth/oauth2/OAuth2Utils.java 67.21% <0.00%> (+1.63%) 12.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 662bd80...96aabab. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chingor13 added 13 commits April 24, 2020 10:34
@chingor13
test: inject HttpTransportFactory for testing
cc54919
@chingor13
test: inject HttpTransportFactory for testing
b32e57b
@chingor13
fix: use google-http-client for actual signature verification
141686a
@chingor13
Merge branch 'master' into verify-id-token-instance
5464115
@chingor13
Merge branch 'master' into verify-id-token-instance
1d08829
@chingor13
chore: lint
261c7c2
@chingor13
test: split test into unit and integration
59bfcd0
Unit tests mock out the http request activity. Integration tests hit the
live urls.
@chingor13
chore: lint
5dd6b44
@chingor13
fix: return the JsonWebSignature instance on verify
48aea1d
@chingor13
test: remove IT test as the signature keys can/will change over time
5709b80
@chingor13
docs: add javadoc for TokenVerifier
d3ab6ea
@chingor13
docs: add guide for verifying tokens in the README
96ab0db
@chingor13
chore: remove auto-value config changes
a94672a
@chingor13
chingor13 marked this pull request as ready for review May 28, 2020 19:43
@chingor13
chingor13 requested review from a team and bshaffer May 28, 2020 19:43
elharo
elharo reviewed May 28, 2020
View reviewed changes
Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

chingor13 added 2 commits May 28, 2020 13:18
@chingor13
chore: tense, lower-case first word, no period
b79e90d
@chingor13
chore: run formatter
c57fdb1
@chingor13 chingor13 mentioned this pull request May 28, 2020
feat: add ability to verify id tokens #419
Closed
elharo
elharo reviewed May 28, 2020
View reviewed changes
Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

chingor13 added 2 commits May 28, 2020 13:34
@chingor13
chore: more javadoc fixes
7e3234d
@chingor13
Merge branch 'master' into verify-id-token-instance
9755703
@chingor13
chingor13 requested a review from BenWhitehead May 28, 2020 21:16
@chingor13
chore: remove line from README example
24e1ec6
bshaffer
bshaffer reviewed May 29, 2020
View reviewed changes
Comment thread README.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@chingor13
sample: add snippet showing check for additional claim
cdedabc
BenWhitehead
BenWhitehead reviewed Jun 3, 2020
View reviewed changes
Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

bshaffer
bshaffer reviewed Jun 5, 2020
View reviewed changes
Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

bshaffer
bshaffer approved these changes Jun 24, 2020
View reviewed changes
@bshaffer

bshaffer commented Jun 24, 2020

Copy link
Copy Markdown
Contributor

@BenWhitehead @elharo If you have no additional concerns can one of you approve this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chingor13
fix: remove default constructor - users should always use builder
96aabab
BenWhitehead
BenWhitehead approved these changes Jun 24, 2020
View reviewed changes
@chingor13
chingor13 merged commit 5014ac7 into googleapis:master Jun 24, 2020
@chingor13
chingor13 deleted the verify-id-token-instance branch June 24, 2020 19:58
gcf-merge-on-green Bot pushed a commit that referenced this pull request Jun 24, 2020
@release-please
chore: release 0.21.0 (#442)
48ba24a
🤖 I have created a release \*beep\* \*boop\* 
---
## [0.21.0](https://www.github.com/googleapis/google-auth-library-java/compare/v0.20.0...v0.21.0) (2020-06-24)


### Features

* add TokenVerifier class that can verify RS256/ES256 tokens ([#420](https://www.github.com/googleapis/google-auth-library-java/issues/420)) ([5014ac7](https://www.github.com/googleapis/google-auth-library-java/commit/5014ac72a59d877ef95c616d0b33792b9fc70c25))


### Dependencies

* update autovalue packages to v1.7.2 ([#429](https://www.github.com/googleapis/google-auth-library-java/issues/429)) ([5758364](https://www.github.com/googleapis/google-auth-library-java/commit/575836405bd5803d6202bd0018609184d6a15831))
* update dependency com.google.http-client:google-http-client-bom to v1.35.0 ([#427](https://www.github.com/googleapis/google-auth-library-java/issues/427)) ([5494ec0](https://www.github.com/googleapis/google-auth-library-java/commit/5494ec0a73319fb955b3d7ba025aea9607020c4e))
* update Guava to 29.0-android ([#426](https://www.github.com/googleapis/google-auth-library-java/issues/426)) ([0cd3c2e](https://www.github.com/googleapis/google-auth-library-java/commit/0cd3c2ec0aef3ff0f0379b32f9d05126442219b6))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
@release-please release-please Bot mentioned this pull request Jan 4, 2022
chore(main): release google-auth-library-java 1.0.0 #819
Closed
@release-please release-please Bot mentioned this pull request Aug 11, 2022
chore(main): release 1.11.0 #974
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jul 12, 2026
feat: 구글/카카오 소셜 로그인, JWT 인증, 토큰 재발급 기능 구현 lirouti/Li-routi_Backend#9
Merged
9 of 16 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@elharo elharo elharo left review comments
@bshaffer bshaffer bshaffer approved these changes
@BenWhitehead BenWhitehead BenWhitehead approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

FR: jwt validate

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@chingor13 @bshaffer @elharo @BenWhitehead @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.