@Test void getApplicationTokenDetailsAccessTokenIsExpired() { onBehalfOfUsernameHolder.removeUser(); UserKey userKey1 = new UserKey("user1", "realm1"); onBehalfOfUsernameHolder.putUser(userKey1); TokenDetails tokenDetails = new TokenDetails(); tokenDetails.setAccessToken("access-token123"); tokenDetails.setRefreshToken("refresh-token123"); applicationTokenHolder.setTokenDetails(userKey1, tokenDetails); when(oAuthClient.obtainTokenDetailsByRunOnBehalfOfUserCredentials( userKey1.getLogin(), userKey1.getRealm())) .thenReturn(tokenDetails); when(oidcAuthenticationHelper.isTokenExpiredOrShouldBeRefreshed(tokenDetails)).thenReturn(true); TokenDetails refreshedTokenDetails = new TokenDetails(); when(oAuthClient.obtainTokenDetailsByRefreshToken(tokenDetails.getRefreshToken())) .thenReturn(refreshedTokenDetails); TokenDetails applicationTokenDetails = service.getApplicationTokenDetails(); assertEquals(applicationTokenDetails, refreshedTokenDetails); }
public TokenDetails getApplicationTokenDetails() { UserKey user = getRunOnBehalfOfUser(); return getApplicationTokenDetailsForUser(user); }
ApplicationTokenService { public TokenDetails getApplicationTokenDetails() { UserKey user = getRunOnBehalfOfUser(); return getApplicationTokenDetailsForUser(user); } }
ApplicationTokenService { public TokenDetails getApplicationTokenDetails() { UserKey user = getRunOnBehalfOfUser(); return getApplicationTokenDetailsForUser(user); } @Autowired  ApplicationTokenService(OAuthClient oAuthClient,
                                   OidcAuthenticationHelper oidcAuthenticationHelper,
                                   OnBehalfOfUsernameHolder onBehalfOfUsernameHolder,
                                   ApplicationTokenHolder applicationTokenHolder,
                                   OidcConfiguration oidcConfiguration); }
ApplicationTokenService { public TokenDetails getApplicationTokenDetails() { UserKey user = getRunOnBehalfOfUser(); return getApplicationTokenDetailsForUser(user); } @Autowired  ApplicationTokenService(OAuthClient oAuthClient,
                                   OidcAuthenticationHelper oidcAuthenticationHelper,
                                   OnBehalfOfUsernameHolder onBehalfOfUsernameHolder,
                                   ApplicationTokenHolder applicationTokenHolder,
                                   OidcConfiguration oidcConfiguration); TokenDetails getApplicationTokenDetails(); }
ApplicationTokenService { public TokenDetails getApplicationTokenDetails() { UserKey user = getRunOnBehalfOfUser(); return getApplicationTokenDetailsForUser(user); } @Autowired  ApplicationTokenService(OAuthClient oAuthClient,
                                   OidcAuthenticationHelper oidcAuthenticationHelper,
                                   OnBehalfOfUsernameHolder onBehalfOfUsernameHolder,
                                   ApplicationTokenHolder applicationTokenHolder,
                                   OidcConfiguration oidcConfiguration); TokenDetails getApplicationTokenDetails();  }