| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <html> |
| <head> |
| <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> |
| <meta name="apple-mobile-web-app-capable" content="yes"/> |
| <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> |
| <link rel="stylesheet" type="text/css" href="/ui-min.css"/> |
| <title>Sign in</title> |
| </head> |
| <body> |
| <h1>Sign in with an OAuth provider</h1> |
| <br/> |
| |
| <script type="text/javascript"> |
| function queryParams() { |
| qp = new Array(); |
| qs = window.location.search.substring(1).split('&'); |
| for (i = 0; i < qs.length; i++) { |
| e = qs[i].indexOf('='); |
| if (e > 0) |
| qp[qs[i].substring(0, e)] = unescape(qs[i].substring(e + 1)); |
| } |
| return qp; |
| } |
| |
| function oauthReferrer() { |
| r = queryParams()['openauth_referrer']; |
| if (typeof(r) == 'undefined') |
| return '/'; |
| q = r.indexOf('?'); |
| if (q > 0) |
| return r.substring(0, q); |
| return r; |
| } |
| |
| if (typeof(oauthReferrer()) == 'undefined') { |
| document.location = '/'; |
| } |
| |
| function clearAuthCookie() { |
| document.cookie = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainName(window.location.hostname) + '; path=/'; |
| document.cookie = 'TuscanyOAuth1=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainName(window.location.hostname) + '; path=/'; |
| document.cookie = 'TuscanyOAuth2=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainName(window.location.hostname) + '; path=/'; |
| document.cookie = 'TuscanyOpenIDAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainName(window.location.hostname) + '; path=/'; |
| return true; |
| } |
| |
| function submitSignin2(w) { |
| parms = w(); |
| clearAuthCookie(); |
| document.signin2.oauth2_authorize.value = parms[0]; |
| document.signin2.oauth2_access_token.value = parms[1]; |
| document.signin2.oauth2_client_id.value = parms[2]; |
| document.signin2.oauth2_info.value = parms[3]; |
| document.signin2.oauth2_scope.value = parms[4]; |
| document.signin2.oauth2_display.value = parms[5]; |
| document.signin2.openauth_referrer.value = oauthReferrer(); |
| document.signin2.action = '/oauth2/authorize/'; |
| document.signin2.submit(); |
| } |
| |
| function withFacebook() { |
| var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'facebook.com', 'https://graph.facebook.com/me', 'email', 'page']; |
| return parms; |
| } |
| |
| function withGithub() { |
| var parms = ['https://github.com/login/oauth/authorize', 'https://github.com/login/oauth/access_token', 'github.com', 'https://github.com/api/v2/json/user/show', 'email', '']; |
| return parms; |
| } |
| |
| function submitSignin1(w) { |
| parms = w(); |
| clearAuthCookie(); |
| document.signin1.oauth1_request_token.value = parms[0]; |
| document.signin1.oauth1_authorize.value = parms[1]; |
| document.signin1.oauth1_access_token.value = parms[2]; |
| document.signin1.oauth1_client_id.value = parms[3]; |
| document.signin1.oauth1_info.value = parms[4]; |
| document.signin1.openauth_referrer.value = oauthReferrer(); |
| document.signin1.action = '/oauth1/authorize/'; |
| document.signin1.submit(); |
| } |
| |
| function withLinkedin() { |
| var parms = ['https://api.linkedin.com/uas/oauth/requestToken', 'https://www.linkedin.com/uas/oauth/authorize', 'https://api.linkedin.com/uas/oauth/accessToken', 'linkedin.com', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,public-profile-url)']; |
| return parms; |
| } |
| |
| function withTwitter() { |
| var parms = ['https://api.twitter.com/oauth/request_token', 'https://api.twitter.com/oauth/authorize', 'https://api.twitter.com/oauth/access_token', 'twitter.com', 'https://api.twitter.com/1/statuses/user_timeline.json']; |
| return parms; |
| } |
| </script> |
| |
| <form name="fields"> |
| <p>Sign in with your Facebook account<br/><input type="button" onclick="submitSignin2(withFacebook)" value="Sign in"/></p> |
| <p>Sign in with your Github account<br/><input type="button" onclick="submitSignin2(withGithub)" value="Sign in"/></p> |
| <p>Sign in with your Linkedin account<br/><input type="button" onclick="submitSignin1(withLinkedin)" value="Sign in"/></p> |
| <p>Sign in with your Twitter account<br/><input type="button" onclick="submitSignin1(withTwitter)" value="Sign in"/></p> |
| </form> |
| |
| <form name="signin2" action="/" method="GET"> |
| <input type="hidden" name="oauth2_authorize" value=""/> |
| <input type="hidden" name="oauth2_access_token" value=""/> |
| <input type="hidden" name="oauth2_client_id" value=""/> |
| <input type="hidden" name="oauth2_info" value=""/> |
| <input type="hidden" name="oauth2_scope" value=""/> |
| <input type="hidden" name="oauth2_display" value=""/> |
| <input type="hidden" name="openauth_referrer" value=""/> |
| </form> |
| |
| <form name="signin1" action="/" method="GET"> |
| <input type="hidden" name="oauth1_request_token" value=""/> |
| <input type="hidden" name="oauth1_authorize" value=""/> |
| <input type="hidden" name="oauth1_access_token" value=""/> |
| <input type="hidden" name="oauth1_client_id" value=""/> |
| <input type="hidden" name="oauth1_info" value=""/> |
| <input type="hidden" name="openauth_referrer" value=""/> |
| </form> |
| |
| </body> |
| </html> |