This is great! We built an Ionic app, now I was able to authenticate from the Ionic app to Apache Isis RO services, tenancy control is working just fine too from it. Great to hear you are planning to include this in some quickstart app. It works great cross-platform for Android and Ios.
This is really great stuff!!! Cesar. -----Original Message----- From: Dan Haywood [mailto:[email protected]] Sent: Sunday, December 13, 2015 10:49 AM To: users Subject: Swagger UI integration, custom mobile apps Hi folks We've recently been working on building a new mobile app recently [1], leveraging the new content negotiation stuff in 1.11.0-SNAPSHOT that returns simplified representations. To help build this app we've also put together integration with Swagger UI. The mobile app example demonstrates this, and we'll make it part of the simpleapp archetype for 1.11.0. The app itself uses Ionic, which is a mobile framework that sits on top of AngularJS. What's nice about this particular framework is that it leverages Apache Cordova, so the mobile apps can be packaged as either iOS or Android apps. The app uses the Apache REST API, and also implements HTTP Basic auth. I've also recorded a pair of screencasts, one demonstrating the swagger UI [2] and the second demonstrating the ionic frontend [3]. They are a bit rough-n-ready, but hopefully give the general gist. The ionic app doesn't actually use any of the swagger generated stubs, but the swagger UI is still very handy to help understand the data available in the REST API. Feedback welcome as ever, some more detailed notes below. Cheers Dan ~~~~ Some further notes: - the contactapp [1] is structured as "frontend" and "backend". I modified the various gulp files etc so that "ionic serve" publishes not to "www" but instead to ../backend/webapp/src/main/webapp/frontend. This means that the Isis webapp can host the frontend as a webapp that calls back on itself. - in web.xml [4], you should set whenNoSession to "unauthorized". The default, "basicAuthChallenge", causes chrome to pop up its own auth prompt dialog, which isn't what we want. - the basic design for security is for the login controller to attempt to access /restful/user using a HTTP basic auth header [5]. If it succeeds then this is made the default for all subsequent requests [6] - it isn't necessary to configure swagger-ui to make this work, but if you want to do so, then the only requirements are to change the web.xml [7] and to copy in the swagger-ui/index.html file verbatim [8] [1] https://github.com/incodehq/contactapp [2] https://youtu.be/87UhGeNXSHc [3] https://youtu.be/7rL8vQEHZgE [4] https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/backend/webapp/src/main/webapp/WEB-INF/web.xml#L293 [5] https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/frontend/src/authentication.js#L79 [6] https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/frontend/src/authentication.js#L61 [7] https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/backend/webapp/src/main/webapp/WEB-INF/web.xml#L196 [8] https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/backend/webapp/src/main/webapp/swagger-ui/index.html --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
