Skip to content

Commit dc7f7e8

Browse files
committed
chore: moving the oauth to a separate library
Signed-off-by: Pawel Psztyc <jarrodek@gmail.com>
0 parents  commit dc7f7e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+14450
-0
lines changed

.github/workflows/deployment.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Tests and publishing
2+
env:
3+
FORCE_COLOR: 1
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
- develop
10+
pull_request:
11+
branches:
12+
- master
13+
- main
14+
jobs:
15+
test_linux:
16+
name: Ubuntu
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-node@v1
21+
with:
22+
node-version: 14
23+
- uses: microsoft/playwright-github-action@v1
24+
- uses: actions/cache@v1
25+
with:
26+
path: ~/.npm
27+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-node-
30+
- name: Install dependencies
31+
run: npm ci
32+
- name: Run tests
33+
run: npm test
34+
tag:
35+
name: "Publishing release"
36+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
37+
needs:
38+
- test_linux
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v2
43+
with:
44+
fetch-depth: 0
45+
- uses: actions/setup-node@v2
46+
with:
47+
node-version: '14.x'
48+
registry-url: 'https://registry.npmjs.org'
49+
- uses: actions/cache@v1
50+
with:
51+
path: ~/.npm
52+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
53+
restore-keys: |
54+
${{ runner.os }}-node-
55+
- run: npm install
56+
- name: Read version from package.json
57+
uses: culshaw/read-package-node-version-actions@v1
58+
id: package-node-version
59+
- name: Changelog
60+
uses: scottbrenner/generate-changelog-action@master
61+
id: Changelog
62+
- name: Github Release
63+
id: create_release
64+
uses: actions/create-release@latest
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
tag_name: v${{ steps.package-node-version.outputs.version }}
69+
release_name: v${{ steps.package-node-version.outputs.version }}
70+
body: |
71+
${{ steps.Changelog.outputs.changelog }}
72+
draft: false
73+
prerelease: false
74+
- run: npm publish --access public
75+
env:
76+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# General
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
# Icon must end with two \r
7+
Icon
8+
9+
10+
# Thumbnails
11+
._*
12+
13+
# Windows thumbnail cache files
14+
Thumbs.db
15+
ehthumbs.db
16+
ehthumbs_vista.db
17+
18+
# Dump file
19+
*.stackdump
20+
21+
# Folder config file
22+
[Dd]esktop.ini
23+
24+
# Recycle Bin used on file shares
25+
$RECYCLE.BIN/
26+
27+
# Windows Installer files
28+
*.cab
29+
*.msi
30+
*.msix
31+
*.msm
32+
*.msp
33+
34+
# Windows shortcuts
35+
*.lnk
36+
37+
.vscode/*
38+
!.vscode/settings.json
39+
!.vscode/tasks.json
40+
!.vscode/launch.json
41+
!.vscode/extensions.json
42+
43+
*~
44+
45+
# temporary files which can be created if a process still has a handle open of a deleted file
46+
.fuse_hidden*
47+
48+
# KDE directory preferences
49+
.directory
50+
51+
# Linux trash folder which might appear on any partition or disk
52+
.Trash-*
53+
54+
# .nfs files are created when an open file is removed but is still being accessed
55+
.nfs*
56+
57+
node_modules
58+
coverage
59+
dev/jexl.window.js

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage/
2+
test/
3+
.*
4+
commitlint.config.js
5+
web-test-runner.config.mjs

LICENSE.md

Lines changed: 233 additions & 0 deletions
Large diffs are not rendered by default.

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {extends: ['@commitlint/config-conventional']}

index.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
@license
3+
Copyright 2021 The Advanced REST client authors <arc@mulesoft.com>
4+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
use this file except in compliance with the License. You may obtain a copy of
6+
the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
License for the specific language governing permissions and limitations under
12+
the License.
13+
*/
14+
export { OAuth2Authorization } from './src/OAuth2Authorization'
15+
export { OidcAuthorization } from './src/OidcAuthorization.js'
16+
export { OAuth1Authorization } from './src/OAuth1Authorization'
17+
export { AuthorizationError, CodeError } from './src/AuthorizationError'
18+
export * as Utils from './src/Utils';
19+
export * from './src/types';

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
@license
3+
Copyright 2021 The Advanced REST client authors <arc@mulesoft.com>
4+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
use this file except in compliance with the License. You may obtain a copy of
6+
the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
License for the specific language governing permissions and limitations under
12+
the License.
13+
*/
14+
export { OAuth2Authorization } from './src/OAuth2Authorization.js'
15+
export { OidcAuthorization } from './src/OidcAuthorization.js'
16+
export { OAuth1Authorization } from './src/OAuth1Authorization.js'
17+
export { AuthorizationError, CodeError } from './src/AuthorizationError.js'
18+
export * as Utils from './src/Utils.js';

oauth-popup.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Oauth2 callback window</title>
6+
<style>*[hidden] { display: none; } </style>
7+
</head>
8+
<body>
9+
<h1>Sending the authorization data to the application</h1>
10+
<p id="general-error" hidden>
11+
The window wasn't opened as a popup and therefore it can't pass the authorization information.<br/>
12+
This is an error.
13+
</p>
14+
<script>
15+
const messageTarget = (window.opener || window.parent || window.top);
16+
if (!messageTarget || messageTarget === window || !messageTarget.postMessage) {
17+
const elm = document.getElementById('general-error');
18+
elm.removeAttribute('hidden');
19+
} else {
20+
const search = window.location.search.substr(1);
21+
if (search) {
22+
messageTarget.postMessage(search, '*');
23+
} else {
24+
messageTarget.postMessage(window.location.hash.substr(1), '*');
25+
}
26+
}
27+
</script>
28+
</body>
29+
</html>

0 commit comments

Comments
 (0)