Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of method and system of user's log-on webpage, can when cross-domain accessed web page, need not the user and repeat to import ID and key, thereby improve webpage browsing efficiency.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of method of user's log-on webpage, said method comprises:
To after the subscriber authentication success, will be saved in browser in the webpage under first domain name to the successful cookie information of subscriber authentication;
After the user jumps to the webpage under second domain name; Send the checking request that comprises said cookie information to authentication server through said browser; According to said cookie information the user is carried out authentication, verify that successfully the webpage under said second domain name is logined in the back.
In such scheme, saidly the user is carried out authentication according to said cookie information, verify the webpage under successful said second domain name of back login, comprising:
Authentication server carries out authentication according to the cookie information in the said checking request to the user, and will return to said browser to the result that user identity is verified;
That browser receives is that authentication server returns, to behind the successful result of subscriber authentication, show to the user and successfully to login webpage under second domain name.
In such scheme, saidly send the checking request comprise said cookie information to authentication server through said browser, comprising:
Browser sent, carry the successful cookie information of said subscriber authentication in the URL (URL) of webpage under second domain name;
The js program of browser obtains said cookie information from said URL, initiate to comprise the asynchronous JavaScript and XML (ajax) request of said cookie information to authentication server.
In such scheme, to after the subscriber authentication success, will be saved in browser in the webpage under first domain name to the successful cookie information of subscriber authentication, comprising:
After in the webpage of the server of first domain name under first domain name user being carried out authentication success, generate, the cookie information that is generated is saved in self and the said browser the successful cookie information of subscriber authentication.
In such scheme; Saidly the user is carried out authentication according to said cookie information; For after: said authentication server receives the checking request that said browser sends, from the server of said first domain name obtain preserved, to the successful cookie information of said subscriber authentication; Cookie information in the said checking request and the cookie information of being obtained are compared, if coupling, then to said subscriber authentication success, if do not match, then to said subscriber authentication failure.
In such scheme, saidly the user is carried out authentication according to said cookie information, for: said authentication server is the server of said first domain name; After the checking request that receives said browser transmission; With the cookie information in the said checking request with preserved, the successful cookie information of said subscriber authentication is compared, if coupling, then successfully to said subscriber authentication; If do not match, then to said subscriber authentication failure.
In such scheme, said cookie information comprises: be used to represent the cookie information of said user identity (ID) and be used to represent current cookie information to the successful checking string of subscriber authentication.
The present invention also provides a kind of system that is used to realize user's log-on webpage, and said system comprises: authentication server and operate in the browser that the user belongs to client, wherein,
Browser, after being used to jump to the webpage under second domain name, said browser sends the checking request that includes cookie information to said authentication server; And after said authentication server was verified successfully, explicit user was logined the webpage under said second domain name;
Authentication server sends the cookie information in the checking request according to said browser, the user is carried out authentication, and the result that will verify returns to said browser;
Wherein, said cookie information in the webpage under first domain name to subscriber authentication success back, be saved in said browser, to the successful cookie information of subscriber authentication.
In such scheme; Said authentication server is the server of second domain name; Said system also comprises: the server of first domain name; Be used for the webpage under first domain name carries out authentication success to the user after, generate, the cookie information that is generated is saved in self and the said browser the successful cookie information of subscriber authentication.
In such scheme, the server of said second domain name, be used to receive the checking request that said browser sends after, from the server of said first domain name obtain preserved, to the successful cookie information of said subscriber authentication; Cookie information in the said checking request and the cookie information of being obtained are compared, to said subscriber authentication success, when matching said subscriber authentication is not failed during coupling; And will return to said browser to the result of subscriber authentication.
In such scheme, said authentication server is the server of said first domain name, and first name server is used for:
After in the webpage under first domain name user being carried out authentication success, generate, the cookie information that is generated is saved in self and the said browser the successful cookie information of subscriber authentication;
After receiving the checking request of said browser transmission; With the cookie information in the said checking request with preserved, the successful cookie information of said subscriber authentication is compared; To said subscriber authentication success, when matching said subscriber authentication is not failed during coupling; And will return to said browser to the result of subscriber authentication.
In such scheme, said browser, also be used for sent, the URL of webpage carries the successful cookie information of said subscriber authentication under second domain name; The js of browser (JavaScript) program obtains said cookie information from said URL, initiate to include the ajax request of said cookie information to said authentication server.
User login method of the present invention and system during webpage, will be written to browser to the successful cookie information of subscriber authentication under login first domain name; And behind the webpage that jumps under second domain name, whether legal through verifying entrained cookie information, come the user is carried out authentication; Thereby jumping under second domain name behind the webpage; Do not need user input ID and key in the webpage under second domain name, just can carry out authentication the user, make the webpage verification using data-hiding technology identity of user under a domain name and login after; The login identity be can carry and Internet resources or network service under other domain names visited; And then the number of times of input ID and key when effectively reducing cross-domain name visit of user and log-on webpage, improve the efficient of user's browsing page, lifting user's viewing experience.
Embodiment
Basic thought of the present invention is: to a plurality of webpages under a plurality of domain names on the internet; The user is therein after the webpage verification using data-hiding technology identity and login under domain name; Can carry Internet resources or the network service under one's name of login identity visit the current field; Do not need the user to repeat to import ID and key carries out authentication, thereby effectively improve the efficient of user's browsing page, promote user's viewing experience.
User's log-on webpage method of the present invention mainly comprises: to after the subscriber authentication success, will be saved in browser to the successful cookie information of subscriber authentication in the webpage under first domain name; After the user jumps to the webpage under second domain name; Send the checking request that comprises said cookie information to authentication server through said browser; According to said cookie information the user is carried out authentication, verify that successfully the webpage under said second domain name is logined in the back.
Here, first domain name is for login any domain name in the domain name.
Particularly, user login method of the present invention with reference to shown in Figure 1, can may further comprise the steps:
Step 101: to after the subscriber authentication success, will be saved in browser in the webpage under first domain name to the successful cookie information of subscriber authentication;
Here, said cookie information comprises: be used to represent the cookie information of said user identity (ID) and be used to represent current cookie information to the successful checking string of subscriber authentication.
Step 102: after jumping to the webpage under second domain name, said browser sends the checking request that includes said cookie information to authentication server;
Step 103: authentication server carries out authentication according to the cookie information in the said checking request to the user, and will return to said browser to the result that user identity is verified;
Step 104: browser receive that authentication server returns, to behind the successful result of subscriber authentication, show to the user and successfully to login webpage under second domain name.
Particularly; In the webpage under first domain name to after the subscriber authentication success; To be saved in browser to the successful cookie information of subscriber authentication; Can comprise: after in the webpage of the server of first domain name under first domain name user being carried out authentication success, generate, the cookie information that is generated is saved in self and the said browser the successful cookie information of subscriber authentication.
Particularly; Send the checking request that comprises said cookie information to authentication server through said browser; Can comprise: when jumping to the webpage under second domain name, browser sent, carry the successful cookie information of said subscriber authentication among the URL of webpage under second domain name; The js of browser (JavaScript) program obtains said cookie information from said URL, initiate to include the ajax request of said cookie information to authentication server.
Particularly; The user is carried out the process of authentication according to said cookie information; Can be for after: said authentication server receives the checking request that said browser sends, from the server of said first domain name obtain preserved, to the successful cookie information of said subscriber authentication; Cookie information in the said checking request and the cookie information of being obtained are compared, if coupling, then to said subscriber authentication success, if do not match, then to said subscriber authentication failure.
Perhaps, the process of the user being carried out authentication according to said cookie information, can also for: said authentication server is the server of said first domain name; After the checking request that receives said browser transmission; With the cookie information in the said checking request and self preserve, the successful cookie information of said subscriber authentication is compared, if coupling, then to said subscriber authentication success; If do not match, then to said subscriber authentication failure.
Accordingly; The present invention also provides a kind of system that is used to realize user's log-on webpage, it is characterized in that, said system comprises: authentication server and operate in the browser that the user belongs to client; Wherein, Browser after being used to jump to the webpage under second domain name, sends the checking request that includes cookie information to said authentication server; And after said authentication server was verified successfully, explicit user was logined the webpage under said second domain name; Authentication server sends the cookie information in the checking request according to said browser, the user is carried out authentication, and the result that will verify returns to said browser; Wherein, said cookie information in the webpage under first domain name to subscriber authentication success back, be written to said browser, to the successful cookie information of subscriber authentication.
Here, said browser, when also being used to jump to the webpage under second domain name, sent, carry the successful cookie information of said subscriber authentication among the URL of webpage under second domain name; The js program of browser obtains said cookie information from said URL, initiate to include the ajax request of said cookie information to said authentication server.
Here, said authentication server is specially server, or the server of said first domain name of second domain name.
At said authentication server is the server of second domain name; Said system can also comprise: the server of first domain name; Be used for the webpage under first domain name carries out the authentication success to the user after; Generation is to the successful cookie information of subscriber authentication, and the cookie information that is generated is saved in self and the said browser.
Wherein, the server of said second domain name, be used to receive the checking request that said browser sends after, from the server of said first domain name obtain preserved, to the successful cookie information of said subscriber authentication; Cookie information in the said checking request and the cookie information of being obtained are compared, to said subscriber authentication success, when matching said subscriber authentication is not failed during coupling; And will return to said browser to the result of subscriber authentication.
Wherein, When said authentication server is the server of said first domain name; First name server; Specifically be used for: the webpage under first domain name carries out authentication success to the user after, generate, the cookie information that is generated is saved in self and the said browser the successful cookie information of subscriber authentication; After receiving the checking request of said browser transmission; With the cookie information in the said checking request and self preserved, the successful cookie information of said subscriber authentication is compared; To said subscriber authentication success, when matching said subscriber authentication is not failed during coupling; And will return to said browser to the result of subscriber authentication.
Below in conjunction with accompanying drawing, the process of cross-domain name accessed web page of the present invention is elaborated.
As shown in Figure 2, idiographic flow is following:
Step 201: the user imports ID and key on the webpage of the domain name a of the current demonstration of browser, and browser obtains the ID and the key of user's input, and sends authentication request to the server of domain name a;
Concrete; After said browser obtains the ID and key of user's input; Trigger an ajax request; Browser is placed on the server of submitting to domain name a in the ajax parameter through the js script of operation domain name a webpage with the ID of user's input and Message Digest Algorithm 5 (md5, the Message Digest Algorithm MD5) coding of key.
Here, browser has obtained the webpage of domain name a in advance from the server of domain name a, and is shown to the user.
The server of step 202: domain name a carries out authentication to the user, and will return to browser to the result of subscriber authentication, if to the subscriber authentication success, then continuestep 203, if to the subscriber authentication failure, returnstep 201;
Here, the server of domain name a receives the authentication request that browser is submitted to, i.e. ajax request; From the parameter that authentication request is carried, read said user's ID and key; And verify whether user's ID and key mate with ID that preserves in advance and key, if, then to the subscriber authentication success; Otherwise, subscriber authentication is failed.
Here, the server of domain name a can will return to browser to the result of subscriber authentication with the form of js function name+json data, make things convenient for browser to discern through the js program of operation webpage.
The server of step 203: the domain name a cookie information that said subscriber authentication is successful is written to the cookie district of browser, and browser shows the webpage of successfully logining under the domain name a to the user, and so far, user's success is with the webpage under the login attitude visit domain name a;
Particularly, the server of domain name a generates the successful cookie information of said subscriber authentication after the subscriber authentication success, the cookie information that is generated is saved in self, and is written to the cookie district of browser.
Here, the cookie information that said subscriber authentication is successful can comprise: be used to represent the cookie information uin of ID and be used to represent current cookie information skey to the successful checking string of subscriber authentication.
Step 204: the webpage under domain name a jumps to the webpage under the domain name b, carries the successful cookie information of said subscriber authentication among the URL that browser is sent during webpage under request visit domain name b.
Particularly; The webpage of browser under the server requests visit domain name b of domain name b; The server of domain name b returns the webpage under the domain name b to browser; Browser receives the webpage that the server of domain name b returns and also is shown to the user, make the user successfully the webpage under the domain name a jump to the webpage under the domain name b.
Here, when browser was visited the webpage under the domain name b to the server requests of domain name b, the URL of browser webpage under the server transmission domain name b of domain name b carried the successful cookie information of said subscriber authentication among the said URL.
Particularly; When the user imports the URL of webpage under the domain name b in browser's address bar; Perhaps the user is when webpage is linked to the webpage under the domain name b under the current domain name a that visits; Browser adds among the URL of webpage under the domain name b the successful cookie information of said subscriber authentication in self cookie district, sends to the server of domain name b, the webpage under the request visit domain name b; Afterwards, the server of domain name b receives the URL that said browser sends, and according to said URL, finds corresponding info web, and returns to said browser; The info web that the server of said browser reception domain name b returns also is shown to the user.
Step 205: whether the cookie information that entrained said subscriber authentication is successful among the webpage URL under the checking domain name b is legal, if, then continuestep 206, if not, then subscriber authentication failure finishes current flow process;
Particularly; Browser to the server of domain name b send carry the URL of the successful cookie information of said subscriber authentication after; The js program of browser obtains the successful cookie information of said subscriber authentication from said URL, initiate the ajax request to authentication server, and request is carried out authentication to said user; Wherein, include the successful cookie information of said subscriber authentication in the said ajax request; Authentication server receives said ajax request, verifies whether the successful cookie information of wherein said subscriber authentication is legal, if then continuestep 206, if not, finish current flow process;
Here; Js code under the browser execution domain name b in the webpage verifies whether comprise the successful cookie information of said subscriber authentication among the said URL, i.e. whether checking comprises said uin parameter and skey parameter; If; Then from said URL, extract the successful cookie information of said subscriber authentication, promptly extract said uin parameter and skey parameter, initiate the ajax request to authentication server; Otherwise, do not initiate the ajax request to authentication server.
Here, said service for checking credentials implement body server that can be domain name b or the server of domain name a.
If said authentication server is the server of domain name b; Verify then whether legal process is the successful cookie information of said subscriber authentication: the server of domain name b at first obtains the successful cookie information of subscriber authentication that preserved, said after receiving the asynchronous JavaScript and XML (ajax, Asynchronous JavaScript and XML) request of browser transmission from the server of domain name a; Then; Cookie information in the server authentication ajax of the domain name b request, whether mate with the cookie information of being obtained, if confirm that then the cookie information that subscriber authentication is successful in the said ajax request is legal; To said subscriber authentication success; Otherwise, confirm that the cookie information that subscriber authentication is successful in the said ajax request is illegal, to said subscriber authentication failure; At last, the server of domain name b will return to browser to the result of subscriber authentication.
If said authentication server is the server of domain name a; Verify then whether legal process is the successful cookie information of said subscriber authentication: after the server of domain name a receives the ajax request of browser transmission; Cookie information in the checking ajax request, whether mate with self institute's successful cookie information of the said subscriber authentication of preserving, if the cookie information that subscriber authentication was successful during then definite said ajax asked is legal; To said subscriber authentication success; Otherwise, confirm that the cookie information that subscriber authentication is successful in the said ajax request is illegal, to said subscriber authentication failure; At last, the server of domain name a will return browser to the result of subscriber authentication.
Step 206: browser shows to the user successfully logins webpage under the domain name b, and so far, user's success is with the webpage under the login attitude visit domain name b.
The above is merely preferred embodiment of the present invention, is not to be used to limit protection scope of the present invention.