We also talk about the Web Start of Single Sign-On (website startup)

Source: Internet
Author: User

When it comes to single sign-on, it is often inseparable from the portal. Usually there are many applications in the enterprise, web or CS. Portal is often made into web. After you log on to the portal, how to start the local CS program from the portal becomes a problem to be solved.

I don't know how everyone solves this problem. My approach is to implement a protocol (just like thunder, donkey, and ant financial) on the portal.

Protocol name: // Application name/job? Action = Action & param1 = parameter 1 & param2 = parameter 2...

This example may be (our protocol name is short for the company, and I will use foo here ):

<A href = "foo: // ERP/order? Action = query & owner = hydonlee "> my orders </a>

This design allows the browser to send requests to our applications like handling HTTP links.

So how can we let the browser send this link to our protocol processor? In this case, you need to register with the system (in Windows). The Registry is as follows:

Windows Registry Editor Version 5.00 [hkey_classes_root \ Foo] @ = "url: Foo application protocol" "URL protocol" = "" [hkey_classes_root \ Foo \ defaulticon] @ = "D: \ workspace \ fooportal \ bin \ Client \ foo.protocolhandler.exe, 1 "[hkey_classes_root \ Foo \ shell] [hkey_classes_root \ Foo \ shell \ open] [hkey_classes_root \ Foo \ shell \ open \ command] @ =" \ "D: \ workspace \ fooportal \ bin \ Client \ foo.protocolhandler.exe \ "\" % 1 \""

How is it? Is it easy? After adding this to the Registry, you can start-> Run and enter FOO: // test/and press enter to test your protocol processor! Windows provides the URL as a parameter to the command line.

The C # code for registering a protocol processor is as follows:

Private void fooprotocolregister () {// copyright (c) hydonlee. For more information, see registrykey Cr = registry. classesroot; registrykey fookey = CR. createsubkey ("foo"); // Add the foo key fookey. setvalue ("", "url: Foo Application Protocol"); fookey. setvalue ("URL protocol", ""); // Add defaulticon registrykey iconkey = fookey. createsubkey ("defaulticon"); iconkey. setvalue ("", String. format ("{0}, 1", application. executablepath. tolowerinvariant (); // Add shell key registrykey shellkey = fookey. createsubkey ("shell"); registrykey openkey = shellkey. createsubkey ("open"); registrykey commandkey = openkey. createsubkey ("command"); commandkey. setvalue ("", String. format ("\" {0} \ "\" % 1 \ "", application. executablepath. tolowerinvariant (); fookey. close ();}

In this way, the link from the browser has been passed to our local application, and the rest is relatively simple. The Protocol processor analyzes this address, calls the corresponding job plug-in, and passes in parameters.

Simply put, the portal generates a link through the Protocol address model-> a browser initiates a request-> A protocol processor assigns-> each application plug-in starts a job.

// Copyright (c) hydonlee

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.