thinktecture/Thinktecture.IdentityServer.v3.AccessTokenValidation — pull request #14 by thirkcircus (2014-11-27 03:33:42+00:00)
Title: Honor token expiry when setting cache expiry

This PR might be unnecessary or implemented incorrectly but it's probably a question worth asking so I'll open up the conversation. :)

The InMemoryClaimsCache (used by ValidationEndpointTokenProvider) sets cache expiry according to IdentityServerBearerTokenAuthenticationOptions.ClaimsCacheDuration.
When caching a token with an expiry shorter than the duration set in settings however, would it make sense to expire the cache according to the token expiry, rather than the options?

PR is a bit larger than ideal cause I had to also abstract out the cache and clock in order to test.
I'm not sure my logic is correct in terms of which claim type to use and the conversion to/from epoch time but the tests do pass. ;) If the PR is considered useful I'll go back and refactor the tests to make them a little clearer/add in Autofixture.

btw, any chance of getting R# or VS solution settings files for project conventions added to the repo? that would help contributions to match existing style.

cheers