Create your own personal OpenID

    Recently, the use of OpenID has become popular. It is convenient, fast and modern.
    OpenID is an open decentralized system of single sign-on, which allows you to use one login and password on a large number of sites. On sites that support OpenID, users do not have to register and remember the data for each site. Instead, they only need to be registered on the site of the "identity provider" OpenID (providing the identifier). Since OpenID technology is decentralized, any site can use OpenID software as a means of entry; OpenID solves the problem by not relying on a centralized site to authenticate the user. ( Wikipedia )

    For me, for some time, it was difficult to remember the line ainu.myopenid.com. Over time, of course, I remembered her, but now instead of ainu.myopenid.com I write ramainen.ru everywhere (my page, I remembered her), and the services understand me perfectly. Of course, I did not become an OpenID provider, but remembering and entering my OpenID has become much easier.

    To do this yourself is very simple. But for this you need a personal server (hosting, you can free) with support for php, asp or any other language. Well, or such a server (hosting) from a friend who kindly does this on a subdomain nick.krasivyadres.ru.
    The essence of the idea is simple: when a service requests an OpenID server, it sends the USER_AGENT parameter in the header
    ["HTTP_USER_AGENT"] =>
    string (40) "php-openid / 2.1.1 (php / 5.2.6) curl / 7.15.5"

    In php, this is torn with $ _SERVER ["HTTP_USER_AGENT"];
    If such a header is available, then you need to redirect the browser to your registered OpenID provider (for example, nickname myopenid.com).
    In php, the ready-made solution is very simple: in index.php (or in another main php file) we write the first lines of the following:
    if (strpos ($ _ SERVER ["HTTP_USER_AGENT"], 'openid')! == false) {
      header ("Location: http://ainu.myopenid.com/");
      // replace ainu.myopenid.com with your OpenID
      exit ();
    }
    


    The presence of the openid substring is checked (what if they change the version).
    Checked on MirTesen and in the comments on a couple of blogs.

    Also popular now: