Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom W 39 posts 96 karma points
    Jun 17, 2013 @ 17:58
    Tom W
    0

    Using an ApplicationContext for another installation

    Hi,

    I have a client, who requires a "single sign-on" for multiple websites (let's assume that they are all 6.1). This will mean that, from each of the websites, a member will be able to log in with a single username/password and access common member properties (e.g. name, address, member number, etc) and be given access to other applications within the "family".

    My intention was to create a "Single Sign-on API", via which I could create a MembershipProvider and associcated functionality, and a bunch of methods to authenticate, authorize and retrieve/update the common information.

    I could obviously build this with a customised data schema, and expose the methods via an assembly referenced by the websites. But it would make sense to have this "hub" also as an Umbraco installation, given the amazing work the team have been doing with the Umbraco context and services recently. It would mean much of the work for member management could be undertaken via the backoffice.

    However, this would mean me being able to create an instance of Umbraco.Core.ApplicationContext which connects to another database. So, in my Umbraco installation "Client1" with DB "client1_db", I would call into an SSO library which would create an ApplicationContext that connects to a database "hub_db" and wrap calls into the various IServices.

    From what I can see in the source code, the creation of an ApplicationContext requires a DatabaseContext, and the DatabaseContext uses a fixed connection string name, "umbracoDbDSN". So it doesn't look like there is any way to create an ApplicationContext except through Umbraco.Core.ApplicationContext.Current.

    Does anyone know if this is possible?

    Otherwise, I think I have 2 options. The first is to use a custom database and write all of the data access methods for creating members, setting properties, etc. The other would be to create a WebAPI project which could be called on a local url (e.g. http://hub.com.local/controller/action, or via TCP possibly), serverside and create an ApplicationContext for the hub installation using the same methodology described here

    Any thoughts or suggestions from the community or the core team would be greatly appreciated.

    EDIT: It looks like my best bet will be to create a RESTful API using the newly exposed UmbracoApiController: http://our.umbraco.org/documentation/Reference/WebApi/ and a bunch of custom models that can be used to encapsulate the data, and then call into the API locally (as all sites are on the same server) and deserialize from JSON to use within the application.

Please Sign in or register to post replies

Write your reply to:

Draft