dylanplecki / KeycloakOwinAuthentication

Keycloak Authentication Middleware for the C# OWIN Pipeline
http://keycloak.jboss.org
MIT License
56 stars 130 forks source link

refresh claims only when not in bearer mode #32

Closed ahus1 closed 8 years ago

ahus1 commented 8 years ago

I was experimenting with bearer tokens and set the TokenClockSkew to a very high number for testing purposes. This lead to a situation where the bearer token was accepted as valid in one place, but then it tried to refresh the access token and failed. TokenClockSkew is not checked in this piece of code that I have now changed.

This will also happen in production, but only less frequently when the TokenClockSkew is set to a reasonably small number. Therefore I decided to change the code.

I think that the library shouldn't try to do any refresh when there is no refresh token. A missing refresh token would indicate that we are operating in bearer token mode.

Please review and comment.