Skip to content

Commit 310a0d1

Browse files
Merge pull request #111 from gjsjohnmurray/authentication-provider
Seed new `prerelease` branch with v3 authentication provider development
2 parents bc7c3a4 + 6baa106 commit 310a0d1

32 files changed

+16429
-797
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
branches:
1515
- master
1616
release:
17+
branches:
18+
- master
1719
types:
1820
- released
1921
jobs:

.github/workflows/prerelease.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: CI-prerelease
2+
3+
on:
4+
push:
5+
branches:
6+
- prerelease
7+
paths-ignore:
8+
- "docs/**"
9+
- ".vscode/**"
10+
- ".github/**"
11+
- "*.md"
12+
- "**/*.md"
13+
pull_request:
14+
branches:
15+
- prerelease
16+
release:
17+
branches:
18+
- prerelease
19+
types:
20+
- released
21+
jobs:
22+
build:
23+
timeout-minutes: 10
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest, windows-latest, macOS-latest]
28+
steps:
29+
- uses: actions/checkout@v2
30+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
31+
- name: Set an output
32+
id: set-version
33+
if: runner.os == 'Windows'
34+
shell: bash
35+
run: |
36+
set -x
37+
VERSION=$(jq -r '.version' package.json | cut -d- -f1)
38+
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
39+
CHANGELOG=$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
40+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
41+
echo ::set-output name=changelog::$CHANGELOG
42+
git tag -l | cat
43+
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
44+
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }}
45+
echo ::set-output name=version::$VERSION
46+
NAME=$(jq -r '.name' package.json)-$VERSION
47+
echo ::set-output name=name::$NAME
48+
tmp=$(mktemp)
49+
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
50+
mkdir dist
51+
echo $VERSION > .version
52+
echo $NAME > .name
53+
- name: Use Node.js
54+
uses: actions/setup-node@v1
55+
with:
56+
node-version: 14.x
57+
- run: npm install
58+
- run: npm run compile
59+
- name: npm test
60+
uses: GabrielBB/[email protected]
61+
with:
62+
run: npm run test
63+
- name: Build pre-release package
64+
if: runner.os == 'Windows'
65+
run: |
66+
npx vsce package --pre-release -o ${{ steps.set-version.outputs.name }}.vsix
67+
- uses: actions/upload-artifact@v2
68+
if: runner.os == 'Windows'
69+
with:
70+
name: ${{ steps.set-version.outputs.name }}.vsix
71+
path: ${{ steps.set-version.outputs.name }}.vsix
72+
- uses: actions/upload-artifact@v2
73+
if: runner.os == 'Windows'
74+
with:
75+
name: meta
76+
path: |
77+
.name
78+
.version
79+
beta:
80+
if: (github.event_name == 'push')
81+
runs-on: windows-latest
82+
needs: build
83+
steps:
84+
- uses: actions/download-artifact@v2
85+
with:
86+
name: meta
87+
path: .
88+
- name: Set an output
89+
id: set-version
90+
if: runner.os == 'Windows'
91+
run: |
92+
set -x
93+
echo ::set-output name=version::`cat .version`
94+
echo ::set-output name=name::`cat .name`
95+
- uses: actions/download-artifact@v2
96+
with:
97+
name: ${{ steps.set-version.outputs.name }}.vsix
98+
- name: Create Pre-Release
99+
id: create_release
100+
uses: actions/create-release@v1
101+
if: runner.os == 'Windows'
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
with:
105+
tag_name: v${{ steps.set-version.outputs.version }}
106+
release_name: v${{ steps.set-version.outputs.version }}
107+
prerelease: ${{ github.event_name != 'release' }}
108+
body: |
109+
Changes in this pre-release
110+
${{ steps.set-version.outputs.changelog }}
111+
- name: Upload Pre-Release Asset
112+
id: upload-release-asset
113+
uses: actions/upload-release-asset@v1
114+
if: runner.os == 'Windows'
115+
env:
116+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
with:
118+
upload_url: ${{ steps.create_release.outputs.upload_url }}
119+
asset_path: ${{ steps.set-version.outputs.name }}.vsix
120+
asset_name: ${{ steps.set-version.outputs.name }}.vsix
121+
asset_content_type: application/zip
122+
publish:
123+
if: github.event_name == 'release'
124+
runs-on: windows-latest
125+
needs: build
126+
steps:
127+
- uses: actions/checkout@v2
128+
with:
129+
ref: prerelease
130+
token: ${{ secrets.TOKEN }}
131+
- uses: actions/download-artifact@v2
132+
with:
133+
name: meta
134+
path: .
135+
- name: Use Node.js
136+
uses: actions/setup-node@v1
137+
with:
138+
node-version: 14.x
139+
- name: Prepare pre-release build
140+
id: set-version
141+
shell: bash
142+
run: |
143+
VERSION=`cat .version`
144+
NEXT_VERSION=`cat .version | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
145+
echo ::set-output name=name::`cat .name`
146+
tmp=$(mktemp)
147+
git config --global user.name 'ProjectBot'
148+
git config --global user.email '[email protected]'
149+
jq --arg version "${NEXT_VERSION}-SNAPSHOT" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
150+
git add package.json
151+
git commit -m 'auto bump version after pre-release'
152+
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
153+
npm install
154+
jq 'del(.enableProposedApi,.enabledApiProposals)' package.json > "$tmp" && mv "$tmp" package.json
155+
git push
156+
- name: Build pre-release package
157+
run: |
158+
npx vsce package --pre-release -o ${{ steps.set-version.outputs.name }}.vsix
159+
- name: Upload Release Asset
160+
id: upload-release-asset
161+
uses: actions/upload-release-asset@v1
162+
if: runner.os == 'Windows'
163+
env:
164+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
with:
166+
upload_url: ${{ github.event.release.upload_url }}
167+
asset_path: ${{ steps.set-version.outputs.name }}.vsix
168+
asset_name: ${{ steps.set-version.outputs.name }}.vsix
169+
asset_content_type: application/zip
170+
- name: Publish to VSCode Marketplace
171+
shell: bash
172+
run: |
173+
[ -n "${{ secrets.VSCE_TOKEN }}" ] && \
174+
npx vsce publish --pre-release --packagePath ${{ steps.set-version.outputs.name }}.vsix -p ${{ secrets.VSCE_TOKEN }} || true

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 3.1.2022012601 (26-Jan-2022 pre-release)
2+
* Update README.
3+
* Automate pre-release publication to Marketplace.
4+
5+
## 3.1.2021122102 (21-Dec-2021 pre-release)
6+
* Make username case-insensitive in authentication provider.
7+
8+
## 3.0.0 (27-Nov-2021 pre-release)
9+
* Implement `intersystems-server-credentials` authentication provider.
10+
111
## 2.0.6 (28-Sep-2021)
212
* Apply `pathPrefix` correctly (#95, #99).
313
* Update vulnerable dependencies.

README.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,78 @@ InterSystems Server Manager is a Visual Studio Code extension for defining conne
55

66
See the [CHANGELOG](https://marketplace.visualstudio.com/items/intersystems-community.servermanager/changelog) for changes in each release.
77

8-
# New in 2.0 - April 2021
8+
# New in Version 3 - November 2021
99

10-
> We are pleased to publish version 2.0 of this extension, adding a tree-style user interface. This significant new release won the [April 2021 InterSystems Programming Contest for Developer Tools](https://openexchange.intersystems.com/contest/13).
10+
We are pleased to publish version 3 of this extension which improves the security of stored passwords by integrating with VS Code's [Authentication Provider API](https://code.visualstudio.com/api/references/vscode-api#AuthenticationProvider). This significant new release took part in the [November 2021 InterSystems Security Contest](https://openexchange.intersystems.com/contest/19).
11+
12+
> 2022-01-26: This is currently a **pre-release**.
1113
1214
> Thanks to [George James Software](https://georgejames.com) for backing this development effort.
1315
16+
## The Authentication Provider
17+
18+
Since version 2 Server Manager has enabled you to store connection passwords in the native keystore of your workstation's operating system. This was a more secure alternative to you putting them as plaintext in your JSON files. However, the `getServerSpec` function in Server Manager 2's API allowed **any** installed extension to obtain these stored passwords without requiring your permission.
19+
20+
VS Code's Authentication Provider API, introduced in version 1.54 ([February 2021](https://code.visualstudio.com/updates/v1_54#_authentication-provider-api)) became mature enough in version 1.63 for us to use.
21+
22+
Server Manager 3 does the following:
23+
24+
1. Implements an authentication provider called 'intersystems-server-credentials'.
25+
2. Uses this authentication provider when accessing servers from its own [Server Tree](#the-server-tree).
26+
3. No longer returns passwords to callers of `getServerSpec`.
27+
28+
> Items #2 and #3 have implications regarding backward compatibility. An interim [legacy mode](#legacy-mode) is available to help with the transition.
29+
30+
### Signing In
31+
32+
The first time you expand a server in the tree VS Code displays a modal dialog asking for your permission:
33+
34+
![Allow an extension](images/README/authenticationProvider-allow.png)
35+
36+
If you allow this and your server definition in `intersystems.servers` does not specify a `username` the next step is:
37+
38+
![Enter username](images/README/authenticationProvider-username.png)
39+
40+
If you proceed, or if this step was skipped because your server definition includes a username, the next step is:
41+
42+
![Enter password](images/README/authenticationProvider-password.png)
43+
44+
If you click the 'key' button after typing your password it will be saved securely in your workstation keychain, from where the 'InterSystems Server Credentials' authentication provider will be able to retrieve it after you restart VS Code.
45+
46+
If instead you press 'Enter' the password will be available only until you restart VS Code.
47+
48+
Either way, you are now signed in on the specified account.
49+
50+
### Trusting Other Extensions
51+
52+
When another extension first asks to use an InterSystems Server Credentials account you must either allow this or deny it. For example, with a pre-release build of the InterSystems ObjectScript extension which uses the new authentication provider you get this after you click the edit pencil button alongside a namespace in the [Server Manager tree](#the-server-tree):
53+
54+
![Allow another extension](images/README/authenticationProvider-allow.png)
55+
56+
### Managing Signed In Accounts
57+
58+
You can use the menu of VS Code's Accounts icon in the activity bar to manage your signed in accounts:
59+
60+
![Manage account](images/README/authenticationProvider-signedIn.png)
61+
62+
The 'Manage Trusted Extensions' option lets you remove an extension from the list of those you previously granted access to this InterSystems Server Credentials account:
63+
64+
![Manage trusted extension list](images/README/authenticationProvider-manageTrusted.png)
65+
66+
The 'Sign Out' option lets you sign out this account after confirmation:
67+
68+
![Sign out](images/README/authenticationProvider-signOut.png)
69+
70+
When signing out an account for which you previously saved the password will get an option to delete the password, unless you have altered the `intersystemsServerManager.credentialsProvider.deletePasswordOnSignout` setting:
71+
72+
![Delete password](images/README/authenticationProvider-deletePassword.png)
73+
74+
---
75+
76+
# New in Version 2 - April 2021
77+
78+
The following features were originally introduced in Server Manager version 2.
79+
1480
## The Server Tree
1581

1682
Server Manager displays connection definitions as a tree on an InterSystems Tools view:
@@ -131,6 +197,14 @@ Use the server's context menu. Alternatively, run `InterSystems Server Manager:
131197

132198
## Technical Notes
133199

200+
### Legacy Mode
201+
202+
Server Manager 3 makes changes which may degrade the user experience relative to version 2. To revert, make this user-level setting:
203+
```json
204+
"intersystemsServerManager.authentication.provider": "none"
205+
```
206+
Please only use this as a short term measure until extensions that use the Server Manager `getServerSpec` API get updated to use the 'intersystems-server-credentials' authentication provider. The setting may be removed in a future release.
207+
134208
### Colors, Favorites and Recents
135209

136210
These features use VS Code's extension-private global state storage. Data is not present in your `settings.json` file.
34 KB
Loading
5.58 KB
Loading
8.42 KB
Loading
7.88 KB
Loading
24.2 KB
Loading
7.45 KB
Loading

0 commit comments

Comments
 (0)