java - How do I call a secured page from my own AppEngine web-service? -
to send html email i'd call different url of own app, have comfort of jsp rendering email-content.
to execute http-call own app first tried use "http://localhost/emailreport" url, failed dns-error. next tried external url:
string appid = apiproxy.getcurrentenvironment().getattributes() .get("com.google.appengine.runtime.default_version_hostname").tostring(); appid = appid.substring(0, appid.indexof('.')); url url = new url("http://" + appid + ".appspot.com/emailreport");
this works, pages without security-constraints in web.xml. emailreport needs secured.
any idea how retrieve page? need use service-account-key? isn't there simple trick?
added:
want secure pages adding web.xml:
<security-constraint> <web-resource-collection> <web-resource-name>securename</web-resource-name> <url-pattern>/mytask</url-pattern> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint>
i solved using following workaround:
caller creates secret token , stores in memcache , adds header request.
endpoint reads header , compares value in memcache. if matches, processes request, otherwise returns 401.
Comments
Post a Comment