[ 
https://issues.apache.org/jira/browse/NIFI-9797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17507656#comment-17507656
 ] 

Tamas Palfy edited comment on NIFI-9797 at 3/16/22, 2:39 PM:
-------------------------------------------------------------

I made the original commit. I did know that the expiration time is in seconds, 
I'm using
{code:java}
fetchTime.plusSeconds(expiresIn - EXPIRY_MARGIN)
{code}
emphasis on *plusSeconds*.

Not sure how I came up with the 5000 though. 5 minutes (300 seconds) is a good 
value in my opinion.

However, it *does not* cause issues. It only results in the service basically 
acquiring a new token ~1.5 hours earlier. Not the best performance-wise but 
wouldn't call it broken.



was (Author: tpalfy):
I made the original commit. I did know that the expiration time is in seconds, 
I'm using
{code:java}
fetchTime.plusSeconds(expiresIn - EXPIRY_MARGIN)
{code}
emphasis on *plusSeconds*.

Not sure how I came up with the 5000 though. 5 minutes (300 seconds) is a good 
value in my opinion.

However, it *does not* cause issues. It only results in the service basically 
acquiring a new token every time (thinking the current one has expired). Not 
the best performance-wise but wouldn't call it broken.


> AccessToken isExpired broken
> ----------------------------
>
>                 Key: NIFI-9797
>                 URL: https://issues.apache.org/jira/browse/NIFI-9797
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.16.0
>            Reporter: Lawrence
>            Assignee: David Handermann
>            Priority: Major
>             Fix For: 1.16.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> While using a build of the current snapshot (1.16.0) so i could use the new 
> StandardOAuth2AccessTokenProvider I ran into an issue with how the 
> AccessToken got changed to calculate if the token is expired.  This is going 
> to break potentially a lot of folks using that AccessToken.  It's subtracting 
> 5000 seconds from the expiresIn property.  I think it was assumed that 
> expires_in would be in millis also, but it is not, per OAuth standards:
> [https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2]
> Here is a link to the PR that got merged where I added a comment ( to little 
> to late ).
> [https://github.com/apache/nifi/pull/5319#pullrequestreview-909366668]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to