a f@s.ddlmmZddlZGdddeZdS)Nc@sDeZdZdZddZddZddZefdd Zd d Zd d Z dS)SecurityTokenContainer<cCs ||_||_tj|dd|_dS)NF)jwtZverify)security_tokensession_key_supplierrdecode)selfrrr E/usr/lib/python3.9/site-packages/oci/auth/security_token_container.py__init__ szSecurityTokenContainer.__init__cCs|jSN)rrr r r get_jwtszSecurityTokenContainer.get_jwtcCs |d S)Nr_expired_with_jitterr r r r validszSecurityTokenContainer.validcCs || Sr r)rjitterr r r valid_with_jittersz(SecurityTokenContainer.valid_with_jittercCs$|jd|jd}||d S)NexpZiat)rr)rZvalid_durationr r r valid_with_half_expiration_timesz6SecurityTokenContainer.valid_with_half_expiration_timecCstt}||jd|kS)ai Checks expiry with some jitter to account for clock skews on the client and also, for non-skewed clients, the scenario where the token was valid when we checked but became invalid before we sent a request (this should be rare). Regarding clock skew, in this context we are only worried about the scenario where the client's time is behind the server time as then tokens look like they will be valid for longer than they are and calls could fail with 401s. If the client's time is ahead of the server time that's not great but it would just lead to tokens being refreshed more often, this would not cause hard failures but could lead to higher perceived latency on the client :param int jitter: The amount of jitter, in seconds, to apply to the expiry time in the token r)inttimer)rrZtime_nowr r r rs z+SecurityTokenContainer._expired_with_jitterN) __name__ __module__ __qualname__ZDEFAULT_EXPIRY_JITTER_SECONDSr rrrrrr r r r r s r)Zoci._vendor.jwtZ_vendorrrobjectrr r r r s