Como os servidores OAuth lidam com um 'refresh_token' solicitado várias vezes?

1

No processo de autenticação OAuth2, os tokens de atualização devem ser usados apenas uma vez. Quando o refresh_token for usado, ele retornará um novo access_token e um novo refresh_token .

Isso também está na especificação RFC6819 :

5.2.2.3. Refresh Token Rotation

Refresh token rotation is intended to automatically detect and prevent attempts to use the same refresh token in parallel from different apps/devices. This happens if a token gets stolen from the client and is subsequently used by both the attacker and the legitimate client. The basic idea is to change the refresh token value with every refresh request in order to detect attempts to obtain access tokens using old refresh tokens. Since the authorization server cannot determine whether the attacker or the legitimate client is trying to access, in case of such an access attempt the valid refresh token and the access authorization associated with it are both revoked.

The OAuth specification supports this measure in that the token's response allows the authorization server to return a new refresh token even for requests with grant type "refresh_token".

Note: This measure may cause problems in clustered environments, since usage of the currently valid refresh token must be ensured. In such an environment, other measures might be more appropriate.

Isso também permite que o servidor de autenticação reconheça que refresh_token foi comprometido, já que deve ser usado apenas uma vez. Se uma nova solicitação de renovação com o mesmo refresh_token vier no servidor de autenticação, sabe que há algo errado acontecendo.

Gostaria de saber qual é a maneira correta de o servidor lidar com esse cenário? Meu palpite seria que pelo menos todo o access_tokens desse cliente em particular deveria ser invalidado diretamente.

Como os servidores OAuth2 geralmente lidam com várias solicitações usando o mesmo refresh_token ?

    
por Wilt 21.12.2016 / 10:59

0 respostas