17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/third_party/example/src/background.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Citrix Systems, Inc. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | chrome.app.runtime.onLaunched.addListener(function() {
17 | chrome.app.window.create('webview.html', {
18 | id: "webview",
19 | innerBounds: {
20 | 'width': 1024,
21 | 'height': 768
22 | }
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/CONTRIBUTING:
--------------------------------------------------------------------------------
1 | Want to contribute? Great! First, read this page (including the small print at the end).
2 |
3 | ### Before you contribute
4 | Before we can use your code, you must sign the
5 | [Google Individual Contributor License Agreement]
6 | (https://cla.developers.google.com/about/google-individual)
7 | (CLA), which you can do online. The CLA is necessary mainly because you own the
8 | copyright to your changes, even after your contribution becomes part of our
9 | codebase, so we need your permission to use and distribute your code. We also
10 | need to be sure of various other things—for instance that you'll tell us if you
11 | know that your code infringes on other people's patents. You don't have to sign
12 | the CLA until after you've submitted your code for review and a member has
13 | approved it, but you must do it before we can put your code into our codebase.
14 | Before you start working on a larger contribution, you should get in touch with
15 | us first through the issue tracker with your idea so that we can help out and
16 | possibly guide you. Coordinating up front makes it much easier to avoid
17 | frustration later on.
18 |
19 | ### Code reviews
20 | All submissions, including submissions by project members, require review. We
21 | use Github pull requests for this purpose.
22 |
23 | ### The small print
24 | Contributions made by corporations are covered by a different agreement than
25 | the one above, the
26 | [Software Grant and Corporate Contributor License Agreement]
27 | (https://cla.developers.google.com/about/google-corporate).
28 |
--------------------------------------------------------------------------------
/src/schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "whitelist": {
5 | "title": "Whitelist of Apps and Filters",
6 | "description": "Carry over a filtered set of the user's cookies to whitelisted participating apps. An empty whitelist will result in the default behavior which is to block all incoming requests and not hand any cookies. Only whitelist apps you fully trust with the user's data. Also please ensure you have all proper consent forms placed for your users as you are granting permissions to certain apps on their behalf and the system will not show the end users any consent forms once permission is granted via admin policy. For more details on filter options, please see https://developer.chrome.com/extensions/cookies#method-getAll. Absence of any filters will return no cookies at all.",
7 | "type": "array",
8 | "items": {
9 | "type": "object",
10 | "properties": {
11 | "appId": {
12 | "title": "Whitelisted App ID",
13 | "description": "ID of the app that the admin wishes to grant a subset of the user's cookies to.",
14 | "type": "string"
15 | },
16 | "domain": {
17 | "title": "Domain for granted cookies",
18 | "description": "A domain for which the helper extension will extract cookies from the user's profile and hand over to requesting appId. This can be further refined by the admin with criteria for cookie name, secure attribute, and path.",
19 | "type": "string"
20 | },
21 | "name": {
22 | "title": "Name for granted cookies",
23 | "description": "A name for which the helper extension will filter the cookies from the user's profile and hand over to requesting appId.",
24 | "type": "string"
25 | },
26 | "path": {
27 | "title": "Path for granted cookies",
28 | "description": "A path for which the helper extension will filter the cookies from the user's profile and hand over to requesting appId.",
29 | "type": "string"
30 | },
31 | "secure": {
32 | "title": "Secure property for granted cookies",
33 | "description": "The secure property for which the helper extension will filter the cookies from the user's profile and hand over to requesting appId.",
34 | "type": "boolean"
35 | }
36 | }
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/src/background.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Google Inc. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | *
17 | * Calls for admin provided whitelist and uses that to extract all
18 | * user cookies that are allowed for app with appId.
19 | *
20 | * Filters are applied jointly with domain being the primary filter
21 | * and all other parameters forming secondary filters in addtiion.
22 | *
23 | * @params {object} params An object containing
24 | * 1. the appId of the caller
25 | * 2. the whitelist configuration fetched from policy
26 | * 3. the callback to return retrieved cookies
27 | */
28 | var getAllCookies= function(params) {
29 | var combinedPromises= [];
30 | var allowed= params.configuration.whitelist.filter(function(entry) { return entry.appId === params.appId; });
31 |
32 | if (!allowed || allowed.length === 0) return params.callback({ cookies: [] });
33 |
34 | allowed.forEach(function(allowedEntry) {
35 | if (!allowedEntry.domain) return; // Domain required as primary filter
36 |
37 | var details= { domain: allowedEntry.domain };
38 | if (allowedEntry.name) details.name= allowedEntry.name;
39 | if (allowedEntry.path) details.path= allowedEntry.path;
40 | if (allowedEntry.secure !== undefined) details.secure= allowedEntry.secure;
41 |
42 | details.storeId = "0"; // Needed otherwise result is empty list if call is made before a browser tab is opened. Probably some strange Chrome-ChromeOS interaction bug.
43 | combinedPromises.push(new Promise(function(resolve, reject) {
44 | chrome.cookies.getAll(details, resolve);
45 | }));
46 | });
47 |
48 | Promise.all(combinedPromises).then(function(combinedResponses) {
49 | combinedResponses= combinedResponses
50 | .reduce(function (prev, cur) { return prev.concat(cur); }, []); // flatten multuple responses into single array
51 |
52 | params.callback({ cookies: combinedResponses });
53 | });
54 | };
55 |
56 | var isolatedWebAppId = function(origin) {
57 | var match = origin.match(/^isolated-app:\/\/(.+)$/);
58 | return match && match[1];
59 | };
60 |
61 | chrome.runtime.onMessageExternal.addListener(
62 | function(request, sender, sendResponse) {
63 | request= request || {};
64 | if (request.method === "getAllCookies") {
65 | chrome.storage.managed.get(function(configuration) {
66 | if (!configuration.whitelist) configuration.whitelist= [];
67 | getAllCookies({
68 | appId: sender.id || isolatedWebAppId(sender.origin),
69 | configuration: configuration,
70 | callback: sendResponse
71 | });
72 | });
73 |
74 | return true; // Informs message handler that response is async
75 | } else {
76 | sendResponse({ sorry : "no_go" });
77 | }
78 | }
79 | );
80 |
--------------------------------------------------------------------------------
/test/testutils.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Google Inc. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | var TestUtils= {};
17 |
18 | TestUtils.HELPER_ID= "efloepbegjfnahghcfpnbkdljabmgnni";
19 |
20 | TestUtils.getCookies= function(params) {
21 | return new Promise(function(resolve) {
22 | chrome.runtime.sendMessage(TestUtils.HELPER_ID, params, resolve);
23 | });
24 | };
25 |
26 | TestUtils.setCookie= function(url, domain, name, value, secure) {
27 | return new Promise(function(resolve) {
28 | chrome.cookies.set({
29 | url: url,
30 | domain: domain,
31 | value: value,
32 | name: name,
33 | secure: secure === undefined ? true : secure
34 | }, resolve);
35 | });
36 | };
37 |
38 | TestUtils.clearAllCookies= function() {
39 | return new Promise(function(resolve) {
40 | chrome.cookies.getAll({}, function(allCookies) {
41 | Promise.all(allCookies.map(function(cookie) {
42 | var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie.domain + cookie.path;
43 | return new Promise(function(resolve, reject) {
44 | chrome.cookies.remove({ url: url, name: cookie.name }, resolve);
45 | });
46 | })).then(resolve);
47 | });
48 | });
49 | };
50 |
51 | TestUtils.assert= function(condition, msg) {
52 | if (!condition) throw new Error(msg);
53 | };
54 |
55 | TestUtils.assertCookieValues= function(cookies, values) {
56 | const sortedCookies = cookies.map(cookie => cookie.value).sort();
57 | const sortedValues = [... values].sort();
58 |
59 | TestUtils.assert(sortedCookies.length === sortedValues.length, `Expected the following cookie values: ${JSON.stringify(sortedValues)}, but got ${JSON.stringify(sortedCookies)}.`);
60 |
61 | for (let i = 0; i < sortedCookies.length; ++i) {
62 | TestUtils.assert(sortedCookies[i] === sortedValues[i], `Error while comparing cookie ${i}: ${sortedCookies[i]} != ${sortedValues[i]}`);
63 | }
64 | };
65 |
66 | TestUtils.testCase= function(testFn) {
67 | return function() {
68 | console.log("Started test case");
69 | return new Promise(function(resolve, reject) {
70 | testFn(function(result) {
71 | console.log("Finished test case");
72 | resolve(result);
73 | }, reject);
74 | })
75 | .then(TestUtils.displayResult)
76 | .then(TestUtils.clearAllCookies)
77 | .then(function() { console.log("Cleared all cookies"); });
78 | };
79 | };
80 |
81 | TestUtils.displayResult= function(result) {
82 | var resultsNode= document.getElementById("results");
83 | var e= document.createElement('div');
84 | e.innerHTML= result;
85 | resultsNode.appendChild(e);
86 | };
87 |
88 | TestUtils.aParams= function(configuration) {
89 | return {
90 | method: "getAllCookies",
91 | configuration: configuration
92 | };
93 | };
94 |
--------------------------------------------------------------------------------
/third_party/example/src/webview.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Citrix Systems, Inc. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | var startNow = function() {
17 | var webview = document.querySelector('webview');
18 | webview.style.height = "auto";
19 | webview.style.width = "100%";
20 |
21 | // Change URL here to load cookies for different URL.
22 | webview.src = "https://github.com";
23 | };
24 |
25 | // Identify domains that we have cookies for.
26 | // Send a request for each domain.
27 | // Set the cookies for the domain using Set-Cookie header using onHeadersReceived event.
28 | function setCookies(cookies) {
29 | // send a request for a given url and set cookies
30 | function sendRequest(url, cookies, requestDone) {
31 | // Load webview element with request URL. Use same partition as Receiver to share cookies
32 | var tempView = document.createElement("webview");
33 |
34 | // We need to always callback after success or error so loadstop event is enough
35 | tempView.addEventListener("loadstop", function(e) {
36 | // we are done with webview
37 | console.log("Done with setting cookies for: " + url);
38 | document.body.removeChild(tempView);
39 | requestDone();
40 | });
41 |
42 | // Set the cookies in response headers
43 | tempView.request.onHeadersReceived.addListener(function (e) {
44 | var headers = e.responseHeaders;
45 | if (e.type === "main_frame") {
46 | if (cookies.length > 0) {
47 | cookies.forEach(function(cookie) {
48 | // Set each cookie as Set-Cookie response header
49 | var result = cookie.name + "=" + cookie.value; // set name-value
50 | if (cookie.expirationDate) { // set expiry, need to use UTC timestmap
51 | var date = new Date(cookie.expirationDate * 1000);
52 | result += "; expires=" + date.toUTCString();
53 | }
54 | if (cookie.domain) { // set domain
55 | result += "; domain=" + cookie.domain;
56 | }
57 | if (cookie.path) { // set path
58 | result += "; path=" + cookie.path;
59 | }
60 | if (cookie.secure === true) { // set secure
61 | result += "; secure";
62 | }
63 | if (cookie.httpOnly === true) { // set secure
64 | result += "; httpOnly";
65 | }
66 | headers.push({"name" : "Set-Cookie", "value" : result});
67 | });
68 | }
69 | }
70 |
71 | // return final headers now
72 | return {
73 | "responseHeaders": headers
74 | };
75 | }, { urls: [url + "/*"] }, ['blocking', "responseHeaders"]); // We care only about the urls we sent request for.
76 |
77 | // No need to show it. Can reuse this if you have lot of domains
78 | tempView.style.display = "none";
79 | tempView.src = url;
80 | document.body.appendChild(tempView); // this will be removed once we are done with request
81 | }
82 |
83 | // Identify list of domains.
84 | var cookieMapping = {}, count = 0;
85 | for (var idx = 0; idx < cookies.length; idx++) {
86 | var cookie = cookies[idx];
87 | if (!cookie) continue;
88 |
89 | var cookie_dom = cookie.domain;
90 | if (cookie_dom[0] === ".") { // trim the leading dot in case a cookie has it.
91 | cookie_dom = cookie_dom.substr(1);
92 | }
93 |
94 | // URL = http + secure + :// + domain
95 | var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie_dom;
96 | if (!cookieMapping[url]) {
97 | cookieMapping[url] = [];
98 | count++;
99 | }
100 | cookieMapping[url].push(cookie); // add cookie to pending url request
101 | }
102 |
103 | // Nothing to do, no cookies present.
104 | if (count === 0) {
105 | startNow();
106 | return;
107 | }
108 |
109 | // send request for each domain
110 | // Let's clear out the cookie store. You can be intelligent and clear out only if we find new cookies compared to previous.
111 | document.querySelector('webview').clearData({since:0}, {cookies:true}, function() {
112 | console.log("Start sending requests: ", cookieMapping);
113 | for (var item in cookieMapping) {
114 | sendRequest(item, cookieMapping[item], function() {
115 | if (--count === 0) {
116 | // done with all requests
117 | startNow();
118 | }
119 | });
120 | }
121 | });
122 | }
123 |
124 | // Send a message to SSO extension and set them to webview cookie store
125 | function getCookies() {
126 | var ssoExtId = "aoggjnmghgmcllfenalipjhmooomfdce"; // https://chrome.google.com/webstore/detail/aoggjnmghgmcllfenalipjhmooomfdce/
127 | chrome.runtime.sendMessage(
128 | ssoExtId,
129 | { method: "getAllCookies" },
130 | function(response) {
131 | console.log("response received from SSO extension: ", response);
132 | if (!response || !response.cookies) {
133 | // we are done
134 | startNow();
135 | return;
136 | }
137 | // persist cookies and start
138 | setCookies(response.cookies);
139 | }
140 | );
141 | }
142 |
143 | window.addEventListener("DOMContentLoaded", getCookies);
144 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SAML SSO for Chrome Apps
2 |
3 | SAML SSO for Chrome devices carries only into applications accessed by Chrome browser and not into Chrome Apps. Chrome Apps that need access to these SAML cookies can request them from the *SAML SSO for Chrome Apps* extension. These apps are granted permission by admins who have to force-install and configure this extension to carry over a filtered set of the user's cookies to the whitelisted participating apps. Documentation for the admin setup can be found on the [Chrome for Work support pages](https://support.google.com/chrome/a/topic/6274255).
4 |
5 | ## Communicating with the extension
6 | The *SAML SSO for Chrome Apps* extension provides an interface over Chrome's [cross-extension messaging system](https://developer.chrome.com/extensions/runtime#method-sendMessage). To get all cookies whitelisted for the participating app by the admin, call *chrome.runtime.sendMessage* with the proper parameters.
7 |
8 | ```javascript
9 | chrome.runtime.sendMessage(
10 | "aoggjnmghgmcllfenalipjhmooomfdce",
11 | { method: "getAllCookies" },
12 | function(response) {
13 | // do something with *response.cookies*
14 | }
15 | );
16 | ```
17 |
18 | ## Using acquired cookies
19 | Once the Chrome App has the relevant authentication cookies, it can attach them to outgoing requests on its hosted webview using the various methods available from webview's [Web Request interface](https://developer.chrome.com/apps/tags/webview#type-WebRequestEventInterface).
20 |
21 | While this is largely dependent on the authentication flow hosted by the app, we provide an [example client](https://github.com/GoogleChrome/chromeos_saml_apps/tree/master/third_party/example) that receives the cookies and saves them to a hosted webview's cookie store by appending *Set-Cookie* headers on incoming requests with the values of these SAML cookies.
22 |
23 | ## Whitelisting apps and domains
24 | The *SAML SSO for Chrome Apps* has to be both force-installed and configured for user accounts. This can be done by navigating directly to [the App Management URL](https://admin.google.com/AdminHome?fral=1#ChromeAppDetails:appId=aoggjnmghgmcllfenalipjhmooomfdce&appType=CHROME&flyout=reg) corresponding to this extension.
25 |
26 | The full schema of possible configurations can be found in [schema.json](https://github.com/GoogleChrome/chromeos_saml_apps/blob/master/src/schema.json). Note that the primary filter is always the domain. Cookie names, paths, and secure properties are all secondary parameters that will be applied *in addition* to the domain filtering. An entry with no domain provided will not return any cookies. An example configuration:
27 |
28 | ```javascript
29 | {
30 | "whitelist": {
31 | "Value": [
32 | {
33 | "appId": "aaaaabbbbbbcccccddddd",
34 | "domain": "domain1",
35 | "secure": true
36 | },
37 | {
38 | "appId": "aaaaabbbbbbcccccddddd",
39 | "domain": "domain1",
40 | "name": "Secondary Cookie Name"
41 | },
42 | {
43 | "appId": "eeeeefffffgggggghhhhhhh",
44 | "domain": "domain1",
45 | "path": "secondary.path"
46 | }
47 | ]
48 | }
49 | }
50 | ```
51 | More details can be found on the [Chrome for Work support page](https://support.google.com/chrome/a/answer/7064180).
52 |
53 | ## Android Runtime for Chrome
54 | Apps developed with [Android Runtime for Chrome](https://developer.chrome.com/apps/getstarted_arc) can also get access to those cookies. They can communicate with the Chrome SSO extension via a special Android intent.
55 |
56 | ```java
57 |
58 | class ChromeMessageReceiver extends BroadcastReceiver {
59 | private static String TAG = "ChromeMessageReceiver";
60 |
61 | public List receivedMessages = new ArrayList();
62 |
63 | public void onReceive(Context context, Intent intent) {
64 | Log.d(TAG, "ARC app received Chrome message: " + intent);
65 | receivedMessages.add(intent);
66 | synchronized (this) {
67 | this.notifyAll();
68 | }
69 | }
70 | }
71 |
72 | public class ChromeMessagingTestActivity extends Activity {
73 | private static String TAG = "ChromeMessagingTestActivity";
74 |
75 | private ChromeMessageReceiver mReceiver = new ChromeMessageReceiver();
76 |
77 | @Override
78 | public void onStart() {
79 | super.onStart();
80 | registerReceiver(mReceiver,
81 | new IntentFilter("org.chromium.arc.CHROME_MESSAGE_RECEIVED"));
82 | }
83 |
84 |
85 | @Override
86 | public void onStop() {
87 | super.onStop();
88 | unregisterReceiver(mReceiver);
89 | }
90 |
91 | public void sendMessage(String extensionId, String data) {
92 | Intent i = new Intent("org.chromium.arc.SEND_CHROME_MESSAGE");
93 | i.setPackage("android");
94 | i.putExtra("org.chromium.arc.ExtensionId", extensionId);
95 | i.putExtra("org.chromium.arc.Request", data);
96 | Log.d(TAG, "ARC app sending Chrome message: " + data);
97 | sendBroadcast(i);
98 | }
99 |
100 | public List getReceivedMessages() {
101 | return mReceiver.receivedMessages;
102 | }
103 |
104 | public boolean waitForMessages(int numberOfMessagesInQueue, int timeout) {
105 | if (mReceiver.receivedMessages.size() < numberOfMessagesInQueue) {
106 | try {
107 | synchronized (mReceiver) {
108 | mReceiver.wait(timeout);
109 | }
110 | } catch (InterruptedException e) {
111 | }
112 | }
113 | return mReceiver.receivedMessages.size() >= numberOfMessagesInQueue;
114 | }
115 | }
116 | ```
117 |
--------------------------------------------------------------------------------
/test/test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Google Inc. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // 1. Replace chrome.storage.managed.get in background.js with (function(callback) { callback(request.configuration); })
18 | // 2. Reload helper extension
19 | // 3. Update extension ID in testutils.js with extension ID from #2
20 | // 4. Load chrome-extension:///test.html into your browser
21 | // Tests should run until "All Tests Passed!" is printed.
22 | (function() {
23 |
24 | var testBadMessageReturnsErrorJson= function(pass, fail) {
25 | TestUtils.getCookies("bad message!")
26 | .then(function(response) {
27 | TestUtils.assert(response.sorry === "no_go");
28 | pass("Passed: Bad message returns error json");
29 | });
30 | };
31 |
32 | var testNoAppIdReturnsNoCookies= function(pass, fail) {
33 | var params= TestUtils.aParams({
34 | "whitelist": [{
35 | "domain": "google.com",
36 | "name": "GMAIL_AT"
37 | }]
38 | });
39 |
40 | TestUtils.getCookies(params)
41 | .then(function(response) {
42 | TestUtils.assert(response.cookies.length === 0);
43 | pass("Passed: No appId returns no cookies");
44 | });
45 | };
46 |
47 | var testAppIdNotInWhitelistReturnsNoCookies= function(pass, fail) {
48 | var params= TestUtils.aParams({
49 | "whitelist": [{
50 | "appId": "RandomAppId",
51 | "domain": "google.com",
52 | "name": "GMAIL_AT"
53 | }]
54 | });
55 |
56 | TestUtils.getCookies(params)
57 | .then(function(response) {
58 | TestUtils.assert(response.cookies.length === 0);
59 | pass("Passed: App Id not whitelisted returns no cookies");
60 | });
61 | };
62 |
63 | var testSingleDomainFilterReturnsMultipleCookies= function(pass, fail) {
64 | var params= TestUtils.aParams({
65 | "whitelist": [{
66 | "appId": chrome.runtime.id,
67 | "domain": "mytesturl.com"
68 | }]
69 | });
70 |
71 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1")
72 | .then(function() { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2"); })
73 | .then(function() { return TestUtils.setCookie("https://some.otherurl.com", "otherurl.com", "Other Name", "othervalue"); })
74 | .then(function() { return TestUtils.getCookies(params); })
75 | .then(function(response) {
76 | TestUtils.assertCookieValues(response.cookies, ["value1", "value2"]);
77 |
78 | pass("Passed: Domain filter returns proper cookies with single domain filter");
79 | });
80 | };
81 |
82 | var testSingleDomainFilterWithPrefixedDotReturnsMultipleCookies= function(pass, fail) {
83 | var params= TestUtils.aParams({
84 | "whitelist": [{
85 | "appId": chrome.runtime.id,
86 | "domain": ".mytesturl.com"
87 | }]
88 | });
89 |
90 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1")
91 | .then(function() { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2"); })
92 | .then(function() { return TestUtils.setCookie("https://some.otherurl.com", "otherurl.com", "Other Name", "othervalue"); })
93 | .then(function() { return TestUtils.getCookies(params); })
94 | .then(function(response) {
95 | TestUtils.assertCookieValues(response.cookies, ["value1", "value2"]);
96 |
97 | pass("Passed: Domain filter returns proper cookies with single domain filter prefixed with dot");
98 | });
99 | };
100 |
101 | var testMultipleDomainFilterReturnsMultipleCookies= function(pass, fail) {
102 | var params= TestUtils.aParams({
103 | "whitelist": [{
104 | "appId": chrome.runtime.id,
105 | "domain": "mytesturl.com"
106 | },
107 | {
108 | "appId": chrome.runtime.id,
109 | "domain": "otherurl.com"
110 | }]
111 | });
112 |
113 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1")
114 | .then(function() { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2"); })
115 | .then(function() { return TestUtils.setCookie("https://some.otherurl.com", "otherurl.com", "Other Name", "othervalue"); })
116 | .then(function() { return TestUtils.setCookie("https://wrongotherurl.com", "wrongotherurl.com", "Wrong Name", "wrong"); })
117 | .then(function() { return TestUtils.getCookies(params); })
118 | .then(function(response) {
119 | TestUtils.assertCookieValues(response.cookies, ["value1", "value2", "othervalue"]);
120 |
121 | pass("Passed: Domain filter returns proper cookies with multiple domain filters");
122 | });
123 | };
124 |
125 | var testNoDomainInFilterReturnsNoCookies= function(pass, fail) {
126 | var params= TestUtils.aParams({
127 | "whitelist": [{
128 | "appId": chrome.runtime.id,
129 | "name": "Name 1"
130 | }]
131 | });
132 |
133 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1")
134 | .then(function() { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2"); })
135 | .then(function() { return TestUtils.getCookies(params); })
136 | .then(function(response) {
137 | TestUtils.assert(response.cookies.length === 0);
138 |
139 | pass("Passed: Domain filter returns no cookies if no domain filter is provided");
140 | });
141 | };
142 |
143 | var testSecondaryFilteringByNameReturnsScopedCookies= function(pass, fail) {
144 | var params= TestUtils.aParams({
145 | "whitelist": [{
146 | "appId": chrome.runtime.id,
147 | "domain": "mytesturl.com",
148 | "name": "Name 2"
149 | }]
150 | });
151 |
152 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1")
153 | .then(function() { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2"); })
154 | .then(function() { return TestUtils.getCookies(params); })
155 | .then(function(response) {
156 | TestUtils.assert(response.cookies.length === 1);
157 | TestUtils.assert(response.cookies[0].name === "Name 2");
158 |
159 | pass("Passed: Domain filter can be scoped by secondary name parameter");
160 | });
161 | };
162 |
163 | var testSecondaryFilteringByPathReturnsScopedCookies= function(pass, fail) {
164 | var params= TestUtils.aParams({
165 | "whitelist": [{
166 | "appId": chrome.runtime.id,
167 | "domain": "mytesturl.com",
168 | "path": "/this/one/here"
169 | }]
170 | });
171 |
172 | TestUtils.setCookie("https://mytesturl.com/this/one/here/XYZ", "mytesturl.com", "Name 1", "value1")
173 | .then(function() { return TestUtils.setCookie("https://mytesturl.com/that/one/there/ABC", "mytesturl.com", "Name 2", "value2"); })
174 | .then(function() { return TestUtils.getCookies(params); })
175 | .then(function(response) {
176 | TestUtils.assert(response.cookies.length === 1);
177 | TestUtils.assert(response.cookies[0].path === "/this/one/here");
178 |
179 | pass("Passed: Domain filter can be scoped by secondary path parameter");
180 | });
181 | };
182 |
183 | var testReturnsUnsecureAndSecureCookies = function (pass, fail) {
184 | var params = TestUtils.aParams({
185 | "whitelist": [{
186 | "appId": chrome.runtime.id,
187 | "domain": "mytesturl.com"
188 | }]
189 | });
190 |
191 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1", true)
192 | .then(function () { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2", false); })
193 | .then(function () { return TestUtils.getCookies(params); })
194 | .then(function (response) {
195 | TestUtils.assertCookieValues(response.cookies, ["value1", "value2"]);
196 |
197 | pass("Passed: Secure filter returns both secure and non-secure if filter is omitted");
198 | });
199 | };
200 |
201 | var testSecureFilterReturnsSecureCookiesOnly = function (pass, fail) {
202 | var params = TestUtils.aParams({
203 | "whitelist": [{
204 | "appId": chrome.runtime.id,
205 | "domain": "mytesturl.com",
206 | "secure": true
207 | }]
208 | });
209 |
210 | TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 1", "value1", true)
211 | .then(function () { return TestUtils.setCookie("https://test.mytesturl.com", "mytesturl.com", "Name 2", "value2", false); })
212 | .then(function () { return TestUtils.getCookies(params); })
213 | .then(function (response) {
214 | TestUtils.assertCookieValues(response.cookies, ["value1"]);
215 |
216 | pass("Passed: Secure filter returns secure cookies only");
217 | });
218 | };
219 |
220 | document.getElementById("startBtn").addEventListener("click", function() {
221 | Promise.resolve("Start Tests")
222 | .then(TestUtils.testCase(testBadMessageReturnsErrorJson))
223 | .then(TestUtils.testCase(testNoAppIdReturnsNoCookies))
224 | .then(TestUtils.testCase(testAppIdNotInWhitelistReturnsNoCookies))
225 | .then(TestUtils.testCase(testSingleDomainFilterReturnsMultipleCookies))
226 | .then(TestUtils.testCase(testSingleDomainFilterWithPrefixedDotReturnsMultipleCookies))
227 | .then(TestUtils.testCase(testMultipleDomainFilterReturnsMultipleCookies))
228 | .then(TestUtils.testCase(testNoDomainInFilterReturnsNoCookies))
229 | .then(TestUtils.testCase(testSecondaryFilteringByNameReturnsScopedCookies))
230 | .then(TestUtils.testCase(testSecondaryFilteringByPathReturnsScopedCookies))
231 | .then(TestUtils.testCase(testReturnsUnsecureAndSecureCookies))
232 | .then(TestUtils.testCase(testSecureFilterReturnsSecureCookiesOnly))
233 | .then(function() { TestUtils.displayResult("All Tests Passed!"); });
234 | });
235 | })();
236 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/third_party/example/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------