@Test public void testComputeResult() { MockAccessBoundary.mock(); AccessTokenCacheFetcher fetcher = new AccessTokenCacheFetcher(ALICE, SCOPES, TARGET); AccessToken token = (AccessToken) fetcher.computeResult(); assertEquals( "FakeAccessToken/GoogleIdentity=alice@altostrat.com;Scopes=" + String.join(",", SCOPES) + ";Target=" + TARGET, token.getValue()); assertEquals(token.getExpiresAt(), 999999999L); }
@Override protected Object computeResult() { String googleIdentity; try { googleIdentity = AbstractUserMapper.getInstance().map(owner); EmailValidation.validateEmail(googleIdentity); } catch (IllegalArgumentException e) { throw Status.PERMISSION_DENIED.withDescription("Principal `" + owner + "` cannot be matched to a Google identity.").asRuntimeException(); } MDC.put(LoggingUtils.MDC_ACCESS_TOKEN_USER_KEY, googleIdentity); AccessToken accessToken = AbstractProvider.getInstance().getAccessToken(googleIdentity, scopes); return AccessBoundaryUtils.addAccessBoundary(accessToken, target); }
AccessTokenCacheFetcher extends CacheFetcher { @Override protected Object computeResult() { String googleIdentity; try { googleIdentity = AbstractUserMapper.getInstance().map(owner); EmailValidation.validateEmail(googleIdentity); } catch (IllegalArgumentException e) { throw Status.PERMISSION_DENIED.withDescription("Principal `" + owner + "` cannot be matched to a Google identity.").asRuntimeException(); } MDC.put(LoggingUtils.MDC_ACCESS_TOKEN_USER_KEY, googleIdentity); AccessToken accessToken = AbstractProvider.getInstance().getAccessToken(googleIdentity, scopes); return AccessBoundaryUtils.addAccessBoundary(accessToken, target); } }
AccessTokenCacheFetcher extends CacheFetcher { @Override protected Object computeResult() { String googleIdentity; try { googleIdentity = AbstractUserMapper.getInstance().map(owner); EmailValidation.validateEmail(googleIdentity); } catch (IllegalArgumentException e) { throw Status.PERMISSION_DENIED.withDescription("Principal `" + owner + "` cannot be matched to a Google identity.").asRuntimeException(); } MDC.put(LoggingUtils.MDC_ACCESS_TOKEN_USER_KEY, googleIdentity); AccessToken accessToken = AbstractProvider.getInstance().getAccessToken(googleIdentity, scopes); return AccessBoundaryUtils.addAccessBoundary(accessToken, target); } AccessTokenCacheFetcher(String owner, List<String> scopes, String target); }
AccessTokenCacheFetcher extends CacheFetcher { @Override protected Object computeResult() { String googleIdentity; try { googleIdentity = AbstractUserMapper.getInstance().map(owner); EmailValidation.validateEmail(googleIdentity); } catch (IllegalArgumentException e) { throw Status.PERMISSION_DENIED.withDescription("Principal `" + owner + "` cannot be matched to a Google identity.").asRuntimeException(); } MDC.put(LoggingUtils.MDC_ACCESS_TOKEN_USER_KEY, googleIdentity); AccessToken accessToken = AbstractProvider.getInstance().getAccessToken(googleIdentity, scopes); return AccessBoundaryUtils.addAccessBoundary(accessToken, target); } AccessTokenCacheFetcher(String owner, List<String> scopes, String target);  }
AccessTokenCacheFetcher extends CacheFetcher { @Override protected Object computeResult() { String googleIdentity; try { googleIdentity = AbstractUserMapper.getInstance().map(owner); EmailValidation.validateEmail(googleIdentity); } catch (IllegalArgumentException e) { throw Status.PERMISSION_DENIED.withDescription("Principal `" + owner + "` cannot be matched to a Google identity.").asRuntimeException(); } MDC.put(LoggingUtils.MDC_ACCESS_TOKEN_USER_KEY, googleIdentity); AccessToken accessToken = AbstractProvider.getInstance().getAccessToken(googleIdentity, scopes); return AccessBoundaryUtils.addAccessBoundary(accessToken, target); } AccessTokenCacheFetcher(String owner, List<String> scopes, String target);   }