gloginPage added by Martin Krasserglogin ComponentAvailable in Camel 2.3 (or latest development snapshot). The glogin component is used by Camel applications outside Google App Engine (GAE) for programmatic login to GAE applications. It is part of the Camel Components for Google App Engine. Security-enabled GAE applications normally redirect the user to a login page. After submitting username and password for authentication, the user is redirected back to the application. That works fine for applications where the client is a browser. For all other applications, the login process must be done programmatically. All the necessary steps for programmatic login are implemented by the glogin component. These are
The authorization cookie must then be send with subsequent HTTP requests to the GAE application. It expires after 24 hours and must then be renewed. URI format
gauth://hostname[:port][?options]
Message headers
Message bodyThe glogin component doesn't read or write message bodies. UsageThe following JUnit test show an example how to login to a development server as well as to a deployed GAE application located at http://camelcloud.appspot.com. GLoginTest.java import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.ProducerTemplate; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import static org.apache.camel.component.gae.login.GLoginBinding.*; import static org.junit.Assert.*; public class GLoginTest { private ProducerTemplate template = ... @Test public void testDevLogin() { Exchange result = template.request("glogin://localhost:8888?username=t...@example.org&devMode=true", null); assertNotNull(result.getOut().getHeader(GLOGIN_COOKIE)); } @Test public void testRemoteLogin() { Exchange result = template.request("glogin://camelcloud.appspot.com", new Processor() { public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader(GLOGIN_USER_NAME, "replac...@gmail.com"); exchange.getIn().setHeader(GLOGIN_PASSWORD, "replaceme"); } }); assertNotNull(result.getOut().getHeader(GLOGIN_COOKIE)); } } The resulting authorization cookie from login to a development server looks like ahlogincookie=t...@example.org:false:11223191102230730701;Path=/ The resulting authorization cookie from login to a deployed GAE application looks (shortened) like ACSID=AJKiYcE...XxhH9P_jR_V3; expires=Sun, 07-Feb-2010 15:14:51 GMT; path=/ DependenciesMaven users will need to add the following dependency to their pom.xml. pom.xml <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-gae</artifactId> <version>${camel-version}</version> </dependency> where ${camel-version} must be replaced by the actual version of Camel (2.3.0 or higher). See Also
Change Notification Preferences
View Online
|
Add Comment
|
- [CONF] Apache Camel > glogin confluence
- [CONF] Apache Camel > glogin confluence
- [CONF] Apache Camel > glogin confluence