private GadgetSpec findSpec(final SecurityToken securityToken, final OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); return specFactory.getGadgetSpec(context); } catch (IllegalArgumentException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec, gadget URI invalid.", e); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec", e); } }
public boolean matches(Object argument) { if (!(argument instanceof OAuthGadgetContext)) { return false; } OAuthGadgetContext context = (OAuthGadgetContext) argument; return (securityToken == context.getToken() && arguments.getBypassSpecCache() == context.getIgnoreCache()); }
public boolean matches(Object argument) { if (!(argument instanceof OAuthGadgetContext)) { return false; } OAuthGadgetContext context = (OAuthGadgetContext) argument; return (securityToken == context.getToken() && arguments.getBypassSpecCache() == context.getIgnoreCache()); }
private GadgetSpec findSpec(final SecurityToken securityToken, final OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); return specFactory.getGadgetSpec(context); } catch (IllegalArgumentException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec, gadget URI invalid.", e); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec", e); } }
public boolean matches(Object argument) { if (!(argument instanceof OAuthGadgetContext)) { return false; } OAuthGadgetContext context = (OAuthGadgetContext) argument; return (securityToken == context.getToken() && arguments.getBypassSpecCache() == context.getIgnoreCache()); }
private GadgetSpec findSpec(final SecurityToken securityToken, final OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); return specFactory.getGadgetSpec(context); } catch (IllegalArgumentException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec, gadget URI invalid.", e); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec", e); } }
private Uri checkGadgetCanRender(SecurityToken securityToken, OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); // This feels really heavy-weight, is there a simpler way to figure out if a gadget requires // a locked-domain? Gadget gadget = processor.process(context); Uri activeUrl = Uri.parse(securityToken.getActiveUrl()); String hostname = activeUrl.getAuthority(); if (!lockedDomainService.isGadgetValidForHost(hostname, gadget, securityToken.getContainer())) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Gadget should not be using URL " + activeUrl); } return activeUrl; } catch (ProcessingException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to check if gadget is using locked-domain", e); } }
private Uri checkGadgetCanRender(SecurityToken securityToken, OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); // This feels really heavy-weight, is there a simpler way to figure out if a gadget requires // a locked-domain? Gadget gadget = processor.process(context); Uri activeUrl = Uri.parse(securityToken.getActiveUrl()); String hostname = activeUrl.getAuthority(); if (!lockedDomainService.gadgetCanRender(hostname, gadget, securityToken.getContainer())) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Gadget should not be using URL " + activeUrl); } return activeUrl; } catch (ProcessingException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to check if gadget is using locked-domain", e); } }
private Uri checkGadgetCanRender(SecurityToken securityToken, OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); // This feels really heavy-weight, is there a simpler way to figure out if a gadget requires // a locked-domain? Gadget gadget = processor.process(context); Uri activeUrl = Uri.parse(securityToken.getActiveUrl()); String hostname = activeUrl.getAuthority(); if (!lockedDomainService.gadgetCanRender(hostname, gadget, securityToken.getContainer())) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Gadget should not be using URL " + activeUrl); } return activeUrl; } catch (ProcessingException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to check if gadget is using locked-domain", e); } }