Skip to content

Commit 856d081

Browse files
jo-arroyoPrithvi Kanherkartnorlingjasonnutter
authored
Basic token validation implementation (#4368)
* Initial commit. * Implement basic validation claims checks, add configuration defaults, * Update tokenValidator, add http client, update errors * Add CryptoProvider * Add linting * Update TokenValidationParameters in line with Wilson * Add JWT token type * Test set up * Update token validator checks and OpenIdConfigProvider properties * Add tests for TokenValidator and OpenIdConfigProvider, update jset.config * Add node-token-validation to CI workflow * Update sample and readme. * Add base readme and update codeowners * Update labeler Co-authored-by: Prithvi Kanherkar <[email protected]> Co-authored-by: Thomas Norling <[email protected]> Co-authored-by: Jason Nutter <[email protected]>
1 parent 95465a8 commit 856d081

Some content is hidden

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

46 files changed

+13239
-12
lines changed

.github/labeler.yml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ msal-browser:
1616
- lib/msal-browser/**/*
1717
msal-react:
1818
- lib/msal-react/**/*
19+
node-token-validation:
20+
- lib/node-token-validation/**/*
1921
adal.js:
2022
- maintenance/adal-angular/**/*
2123
passport-azure-ad:

.github/workflows/build-test-pr.yml

+15-12
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,27 @@ jobs:
3232
# browser/node filter will match any path under common as well as their own
3333
# angular/react filter will match any path under common and browser as well as their own
3434
filters: |
35-
core:
35+
msal-core:
3636
- 'lib/msal-core/**/**.!(md)'
3737
- '.github/workflows/build-test-pr.yml'
38-
common: &common
38+
msal-common: &common
3939
- 'lib/msal-common/**/**.!(md)'
4040
- '.github/workflows/build-test-pr.yml'
41-
browser: &browser
41+
msal-browser: &browser
4242
- *common
4343
- 'lib/msal-browser/**/**.!(md)'
44-
node:
44+
msal-node:
4545
- *common
4646
- 'lib/msal-node/**/**.!(md)'
47-
angular:
47+
msal-angular:
4848
- *browser
4949
- 'lib/msal-angular/**/**.!(md)'
50-
react:
50+
msal-react:
5151
- *browser
5252
- 'lib/msal-react/**/**.!(md)'
53+
node-token-validation:
54+
- *common
55+
- 'lib/node-token-validation/**/**.!(md)'
5356
5457
- uses: dorny/paths-filter@v2
5558
id: extensions-filter
@@ -71,7 +74,7 @@ jobs:
7174
# e.g. ['package1', 'package2'] if both package folders contains changes
7275
library: ${{ fromJSON(needs.pre-check.outputs.packages) }}
7376

74-
name: msal-${{ matrix.library }}
77+
name: ${{ matrix.library }}
7578

7679
steps:
7780
- uses: actions/checkout@v2
@@ -95,23 +98,23 @@ jobs:
9598
run: npm ci
9699

97100
- name: Build packages
98-
working-directory: lib/msal-${{ matrix.library }}
101+
working-directory: lib/${{ matrix.library }}
99102
run: npm run build:all
100103

101104
- name: Lint
102-
working-directory: lib/msal-${{ matrix.library }}
105+
working-directory: lib/${{ matrix.library }}
103106
run: npm run lint
104107

105108
- name: Unit Tests with coverage
106-
working-directory: lib/msal-${{ matrix.library }}
109+
working-directory: lib/${{ matrix.library }}
107110
run: npm run test:coverage
108111

109112
- name: Upload Test Coverage to CodeCov
110113
if: success()
111114
uses: codecov/codecov-action@v2
112115
with:
113-
files: lib/msal-${{matrix.library}}/coverage/lcov.info
114-
flags: msal-${{ matrix.library }}
116+
files: lib/${{matrix.library}}/coverage/lcov.info
117+
flags: ${{ matrix.library }}
115118

116119
extensions-build-test:
117120
needs: pre-check

.github/workflows/build-test-push-to-dev.yml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- msal-node
2828
- msal-angular
2929
- msal-react
30+
- node-token-validation
3031

3132
name: ${{ matrix.library }}
3233

CODEOWNERS

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
/lib/msal-react/ @tnorling @jasonnutter @jo-arroyo @peterzenz
3434
/samples/msal-react-samples/ @tnorling @jasonnutter @jo-arroyo @peterzenz
3535

36+
# Node Token Validation
37+
/lib/node-token-validation @jo-arroyo @pkanher617 @peterzenz
38+
/samples/node-token-validation @jo-arroyo @pkanher617 @peterzenz
39+
3640
## ADAL.js
3741
/maintenance/adal-angular @jasonnutter @sameerag @pkanher617 @peterzenz
3842

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Implement basic token validation #4368",
4+
"packageName": "@azure/node-token-validation",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}

lib/node-token-validation/.babelrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"presets": [
3+
"@babel/preset-typescript",
4+
[
5+
"@babel/preset-env",
6+
{
7+
"modules": "commonjs"
8+
}
9+
]
10+
],
11+
"plugins": [
12+
"@babel/proposal-class-properties",
13+
"@babel/proposal-object-rest-spread"
14+
]
15+
}

lib/node-token-validation/.gitignore

+265
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
8+
*.sln.docstates
9+
10+
# User-specific files (MonoDevelop/Xamarin Studio)
11+
*.userprefs
12+
13+
# Build results
14+
[Dd]ebug/
15+
[Dd]ebugPublic/
16+
[Rr]elease/
17+
[Rr]eleases/
18+
x64/
19+
x86/
20+
bld/
21+
[Bb]in/
22+
[Oo]bj/
23+
[Ll]og/
24+
25+
# Visual Studio 2015 cache/options directory
26+
.vs/
27+
# Uncomment if you have tasks that create the project's static files in wwwroot
28+
#wwwroot/
29+
30+
# MSTest test Results
31+
[Tt]est[Rr]esult*/
32+
[Bb]uild[Ll]og.*
33+
34+
# NUNIT
35+
*.VisualState.xml
36+
TestResult.xml
37+
38+
# Build Results of an ATL Project
39+
[Dd]ebugPS/
40+
[Rr]eleasePS/
41+
dlldata.c
42+
43+
# DNX
44+
project.lock.json
45+
artifacts/
46+
47+
*_i.c
48+
*_p.c
49+
*_i.h
50+
*.ilk
51+
*.meta
52+
*.obj
53+
*.pch
54+
*.pdb
55+
*.pgc
56+
*.pgd
57+
*.rsp
58+
*.sbr
59+
*.tlb
60+
*.tli
61+
*.tlh
62+
*.tmp
63+
*.tmp_proj
64+
*.log
65+
*.vspscc
66+
*.vssscc
67+
.builds
68+
*.pidb
69+
*.svclog
70+
*.scc
71+
72+
# Chutzpah Test files
73+
_Chutzpah*
74+
75+
# Visual C++ cache files
76+
ipch/
77+
*.aps
78+
*.ncb
79+
*.opendb
80+
*.opensdf
81+
*.sdf
82+
*.cachefile
83+
*.VC.db
84+
*.VC.VC.opendb
85+
86+
# Visual Studio profiler
87+
*.psess
88+
*.vsp
89+
*.vspx
90+
*.sap
91+
92+
# TFS 2012 Local Workspace
93+
$tf/
94+
95+
# Guidance Automation Toolkit
96+
*.gpState
97+
98+
# ReSharper is a .NET coding add-in
99+
_ReSharper*/
100+
*.[Rr]e[Ss]harper
101+
*.DotSettings.user
102+
103+
# JustCode is a .NET coding add-in
104+
.JustCode
105+
106+
# TeamCity is a build add-in
107+
_TeamCity*
108+
109+
# DotCover is a Code Coverage Tool
110+
*.dotCover
111+
112+
# NCrunch
113+
_NCrunch_*
114+
.*crunch*.local.xml
115+
nCrunchTemp_*
116+
117+
# MightyMoose
118+
*.mm.*
119+
AutoTest.Net/
120+
121+
# Web workbench (sass)
122+
.sass-cache/
123+
124+
# Installshield output folder
125+
[Ee]xpress/
126+
127+
# DocProject is a documentation generator add-in
128+
DocProject/buildhelp/
129+
DocProject/Help/*.HxT
130+
DocProject/Help/*.HxC
131+
DocProject/Help/*.hhc
132+
DocProject/Help/*.hhk
133+
DocProject/Help/*.hhp
134+
DocProject/Help/Html2
135+
DocProject/Help/html
136+
137+
# Click-Once directory
138+
publish/
139+
140+
# Publish Web Output
141+
*.[Pp]ublish.xml
142+
*.azurePubxml
143+
# TODO: Comment the next line if you want to checkin your web deploy settings
144+
# but database connection strings (with potential passwords) will be unencrypted
145+
*.pubxml
146+
*.publishproj
147+
148+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
149+
# checkin your Azure Web App publish settings, but sensitive information contained
150+
# in these scripts will be unencrypted
151+
PublishScripts/
152+
153+
# NuGet Packages
154+
*.nupkg
155+
# The packages folder can be ignored because of Package Restore
156+
**/packages/*
157+
# except build/, which is used as an MSBuild target.
158+
!**/packages/build/
159+
# Uncomment if necessary however generally it will be regenerated when needed
160+
#!**/packages/repositories.config
161+
# NuGet v3's project.json files produces more ignoreable files
162+
*.nuget.props
163+
*.nuget.targets
164+
165+
# Microsoft Azure Build Output
166+
csx/
167+
*.build.csdef
168+
169+
# Microsoft Azure Emulator
170+
ecf/
171+
rcf/
172+
173+
# Windows Store app package directories and files
174+
AppPackages/
175+
BundleArtifacts/
176+
Package.StoreAssociation.xml
177+
_pkginfo.txt
178+
179+
# Visual Studio cache files
180+
# files ending in .cache can be ignored
181+
*.[Cc]ache
182+
# but keep track of directories ending in .cache
183+
!*.[Cc]ache/
184+
185+
# Others
186+
ClientBin/
187+
~$*
188+
*~
189+
*.dbmdl
190+
*.dbproj.schemaview
191+
*.pfx
192+
*.publishsettings
193+
node_modules/
194+
orleans.codegen.cs
195+
196+
# Since there are multiple workflows, uncomment next line to ignore bower_components
197+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198+
#bower_components/
199+
200+
# RIA/Silverlight projects
201+
Generated_Code/
202+
203+
# Backup & report files from converting an old project file
204+
# to a newer Visual Studio version. Backup files are not needed,
205+
# because we have git ;-)
206+
_UpgradeReport_Files/
207+
Backup*/
208+
UpgradeLog*.XML
209+
UpgradeLog*.htm
210+
211+
# SQL Server files
212+
*.mdf
213+
*.ldf
214+
215+
# Business Intelligence projects
216+
*.rdl.data
217+
*.bim.layout
218+
*.bim_*.settings
219+
220+
# Microsoft Fakes
221+
FakesAssemblies/
222+
223+
# GhostDoc plugin setting file
224+
*.GhostDoc.xml
225+
226+
# Node.js Tools for Visual Studio
227+
.ntvs_analysis.dat
228+
229+
# Visual Studio 6 build log
230+
*.plg
231+
232+
# Visual Studio 6 workspace options file
233+
*.opt
234+
235+
# Visual Studio LightSwitch build output
236+
**/*.HTMLClient/GeneratedArtifacts
237+
**/*.DesktopClient/GeneratedArtifacts
238+
**/*.DesktopClient/ModelManifest.xml
239+
**/*.Server/GeneratedArtifacts
240+
**/*.Server/ModelManifest.xml
241+
_Pvt_Extensions
242+
243+
# Paket dependency manager
244+
.paket/paket.exe
245+
paket-files/
246+
247+
# FAKE - F# Make
248+
.fake/
249+
250+
# Coverage
251+
coverage/
252+
253+
# JetBrains Rider
254+
.idea/
255+
*.sln.iml
256+
257+
# Istanbul Code Coverage
258+
.nyc_output/
259+
260+
# MSAL specific ignore files
261+
node_modules/
262+
typings/
263+
lib/
264+
dist/
265+
ref/

lib/node-token-validation/.huskyrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "npm run lint"
4+
}
5+
}

0 commit comments

Comments
 (0)