New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for jwt validation of infohashes #129

Merged
merged 5 commits into from Feb 25, 2016

Conversation

Projects
None yet
2 participants
@jzelinskie
Member

jzelinskie commented Jan 5, 2016

This change supports JWT on HTTP using the jwt query parameter. The JWT verifies the infohash as being approved by the issuer, which is discovered from the JWKSetURI which is a part of the JWT spec.

@jzelinskie jzelinskie force-pushed the jwt branch 15 times, most recently from aa610e9 to d1b364b Jan 7, 2016

@@ -122,7 +122,7 @@ func New(cfg config.StatsConfig) *Stats {
if cfg.IncludeMem {
s.MemStatsWrapper = NewMemStatsWrapper(cfg.VerboseMem)
s.recordMemStats = time.NewTicker(cfg.MemUpdateInterval.Duration).C
s.recordMemStats = time.After(cfg.MemUpdateInterval.Duration)

This comment has been minimized.

@pushrax

pushrax Feb 14, 2016

Member

Should be time.Tick

return errors.New("Failed to find any issuer from JWK Set URI")
}
ttl, _, _ := oidchttp.Cacheable(resp.Header)

This comment has been minimized.

@pushrax

pushrax Feb 14, 2016

Member

Do we really need to import this whole library just for one function?

}
if claimedIssuer, ok, err := claims.StringClaim("iss"); claimedIssuer != jwkSet.Issuer || err != nil || !ok {
return errors.New("Failed to validate JWT issuer claim")

This comment has been minimized.

@pushrax

pushrax Feb 14, 2016

Member

The first char in errors is typically lowercase right?

@pushrax

This comment has been minimized.

Member

pushrax commented Feb 14, 2016

Pretty much LGTM. Not sure if you want this to be merged before the refactor we were discussing though.

jzelinskie added a commit that referenced this pull request Feb 25, 2016

Merge pull request #129 from chihaya/jwt
add support for jwt validation of infohashes

@jzelinskie jzelinskie merged commit e37f453 into master Feb 25, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jzelinskie jzelinskie deleted the jwt branch Feb 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment