如何给cas前端支持saas软件 [英] How to give cname forward support to saas software

查看:173
本文介绍了如何给cas前端支持saas软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个webapp,用户可以创建他们的帐户并使用该服务。现在我想给他们一个自定义的域名设施,其中
app.customer1web.com points_to myservice.com与userid customer1
一旦他设置了自定义域,对于世界看起来我的服务正在运行他的机器。
许多服务,如博客,wp.com,tumblr给
这个功能。



我该怎么做?
我正在使用java编写我的网络应用程序。
当请求进入时,如何将域名映射到userid?

解决方案


请求进入时,如何将域名映射到userid? b $ b

显然,你必须将这些信息存储在某个地方,很可能在数据库中。


  1. 添加一个数据库表 domains 列:




    • customerId

    • 名称

    • 活动(1或NULL)

    • 挑战



    为(名称,活动)添加唯一的密钥,以确保域名只映射一次。


  2. 当客户尝试添加一个域时,添加一个活动= NULL并将挑战集设置为随机字符串的行。



    显示随机字符串客户并要求他们在网站上放置一个网页,或创建一个虚拟的DNS记录,以验证域名所有权(这是Google Apps的做法)。



    您可以通过向管理联系人发送电子邮件来验证所有权或者以其他方式。


  3. 当客户说他做了你在第2步中指示他们做的事情,验证它并设置active = 1,挑战= NULL。



    如果域先前对某些其他客户有效,请删除这些记录或设置为活动= 0。


  4. 请求客户为其域添加CNAME记录,并将其转发到您的域,例如 hosted.myservice.com (Google针对Google Apps使用 ghs.google.com )。


  5. 当请求进入时,请执行

      SELECT customerId FROM domains WHERE name = :requestDomain AND active = 1 


更好的方法除了自定义域之外,可能会以< customername> .myservice.com 的格式自动向您的客户提供一个域名。这样做有两个好处:




  • 不愿意使用自己的域的客户仍然可以自定义登录页面,例如使用公司标志。


  • 对于自定义域,您可以要求您的客户将其转发到< customername> .myservice.com 而不是通用的 hosted.myservice.com



    在多个服务器之间水平分割客户端,而不必要求客户改变任何结果。例如,您可以给客户一个选择,以选择是否要在欧盟或美国托管他们的帐户。当他们更改它时,只需传输其数据并更新< customername> .myservice.com 。他们的自定义域将自动工作。




为此,您必须设置通配符DNS记录 *。myservice.com (除非您还需要后者功能,否则您必须管理个别记录)。


I have a webapp where users can create their account and use the service. Now I want to give them a custom domain facility where app.customer1web.com points_to myservice.com with userid customer1 once he sets up the custom domain, for the world it looks like my service is running on his machine. Many services like blogger, wp.com, tumblr give this feature.

how do i do that? I am using java to write my web app. How do i map domain name to userid when request comes in?

解决方案

How do i map domain name to userid when request comes in?

Obviously, you'll have to store that information somewhere, most likely in a database.

  1. Add a database table domains with columns:

    • customerId
    • name
    • active (1 or NULL)
    • challenge

    Add unique key for (name, active) to ensure a domain name is mapped only once.

  2. When a customer attempts to add a domain, add a row with active=NULL and challenge set to a random string.

    Show the random string to the customer and ask them to put up a web page with it on the site or create a dummy DNS record with it to verify domain ownership (this is how Google Apps do it).

    You could verify ownership by sending an email to the administrative contact or in some other way.

  3. When the customer says he did what you instructed them to do in step #2, verify it and set active=1, challenge=NULL.

    If the domain was previously active for some other customer, delete those records or set active=0.

  4. Ask the customer to add a CNAME record for their domain and forward it to your domain, e.g. hosted.myservice.com (Google uses ghs.google.com for Google Apps).

  5. When a request comes in, do

    SELECT customerId FROM domains WHERE name=:requestDomain AND active=1
    

A better way may be to automatically offer your customers a domain in the format of <customername>.myservice.com, in addition to custom domains. This gives you two benefits:

  • Customers who don't wan't to use their own domain can still customize their login page, e.g. with a company logo.

  • For custom domains, you can ask your customer to forward them to <customername>.myservice.com instead of to a generic hosted.myservice.com.

    This enables you to horizontally partition customers among multiple servers without having to ask customers to change anything on their end. For example, you could give customers an option to choose whether they want their account hosted in EU or US. When they change it, just transfer their data and update <customername>.myservice.com. Their custom domain will work automatically.

To do this, you'd have to set up a wildcard DNS record for *.myservice.com (unless you also need the latter feature, in which case you'll have to manage individual records).

这篇关于如何给cas前端支持saas软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆