Skip to content

Commit

Permalink
Add travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
everesio committed Feb 2, 2018
1 parent 85cb1d8 commit b287fe1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sudo: false

language: go

go:
- 1.9.x
- tip

services:
- docker

notifications:
email:
on_success: never
on_failure: always

script:
- go build .
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
# google-id-token
Google ID token
## google-id-token

A small application to retrieve or verify google ID token

## Acquire new user credentials
[![Build Status](https://travis-ci.org/grepplabs/google-id-token.svg?branch=master)](https://travis-ci.org/grepplabs/google-id-token)

### Building

go build

### Help output

Retrieve or verify google ID token

Usage:
google-id-token [flags]
google-id-token [command]

Available Commands:
get get cached or new token
help Help about any command
new get a new token
print print the decoded token
verify verify the token

Flags:
--client-id string Client ID (optional)
-h, --help help for google-id-token
-t, --timeout int Timeout in seconds (default 5)


### Acquire new user credentials and oogle ID token
[Application Default Credentials](https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login)

```bash
gcloud auth application-default login
```
gcloud auth application-default login
google-id-token new
google-id-token verify --id-token="$(google-id-token get)"
4 changes: 4 additions & 0 deletions pkg/token/token_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (v *Verifier) VerifyIDToken(ctx context.Context, jwt string, audience strin
}

func (v *Verifier) verifyIDToken(jwt string, audience string, certs *certs) error {
if jwt == "" {
return errors.New("token is empty")
}

header, payload, signature, checksum, err := v.splitToken(jwt)
if err != nil {
return err
Expand Down

0 comments on commit b287fe1

Please sign in to comment.