authResultFromToken projects the OAuth flow's access token and the resolved username onto an AuthResult. A refresh token is present only when the server honored the expiring request, so the refreshable credential is gated on it rather than on requestRefreshToken. requestedAt anchors any expiring tok
(token *oauthapi.AccessToken, username string, requestedAt time.Time)
| 119 | // token is present only when the server honored the expiring request, so the refreshable credential is gated on it |
| 120 | // rather than on requestRefreshToken. requestedAt anchors any expiring token's lifetime. |
| 121 | func authResultFromToken(token *oauthapi.AccessToken, username string, requestedAt time.Time) *AuthResult { |
| 122 | result := &AuthResult{ |
| 123 | Token: token.Token, |
| 124 | Username: username, |
| 125 | } |
| 126 | if token.RefreshToken != "" { |
| 127 | credential := credentialFromAccessToken(token, requestedAt) |
| 128 | result.Refreshable = &credential |
| 129 | } |
| 130 | return result |
| 131 | } |