├── .gitignore
├── .nuget
└── Authfix.Blazor.Extensions.Oidc.nuspec
├── Blazor.Oidc.sln
├── LICENSE
├── README.md
├── appveyor.yml
├── src
├── Blazor.Extensions.Oidc.JS
│ ├── Blazor.Extensions.Oidc.JS.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── package.json
│ ├── src
│ │ ├── BlazorTypes.ts
│ │ ├── BlazorUserManager.ts
│ │ ├── GlobalExports.ts
│ │ └── Initialize.ts
│ ├── tsconfig.json
│ └── webpack.config.js
└── Blazor.Extensions.Oidc
│ ├── Blazor.Extensions.Oidc.csproj
│ ├── IdentityConfiguration.cs
│ ├── IdentityUser.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ └── UserManager.cs
└── test
├── Blazor.Extensions.Oidc.Test.Client
├── App.cshtml
├── Blazor.Extensions.Oidc.Test.Client.csproj
├── Pages
│ ├── Callback.cshtml
│ ├── Counter.cshtml
│ ├── FetchData.cshtml
│ ├── Index.cshtml
│ └── _ViewImports.cshtml
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Shared
│ ├── MainLayout.cshtml
│ ├── NavMenu.cshtml
│ └── SurveyPrompt.cshtml
├── _ViewImports.cshtml
└── wwwroot
│ ├── css
│ ├── bootstrap
│ │ ├── bootstrap.min.css
│ │ └── bootstrap.min.css.map
│ ├── open-iconic
│ │ ├── FONT-LICENSE
│ │ ├── ICON-LICENSE
│ │ ├── README.md
│ │ └── font
│ │ │ ├── css
│ │ │ └── open-iconic-bootstrap.min.css
│ │ │ └── fonts
│ │ │ ├── open-iconic.eot
│ │ │ ├── open-iconic.otf
│ │ │ ├── open-iconic.svg
│ │ │ ├── open-iconic.ttf
│ │ │ └── open-iconic.woff
│ └── site.css
│ └── index.html
├── Blazor.Extensions.Oidc.Test.Identity
├── Blazor.Extensions.Oidc.Test.Identity.csproj
├── Configuration.cs
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Quickstart
│ ├── Account
│ │ ├── AccountController.cs
│ │ ├── AccountOptions.cs
│ │ ├── ExternalController.cs
│ │ ├── ExternalProvider.cs
│ │ ├── LoggedOutViewModel.cs
│ │ ├── LoginInputModel.cs
│ │ ├── LoginViewModel.cs
│ │ ├── LogoutInputModel.cs
│ │ ├── LogoutViewModel.cs
│ │ └── RedirectViewModel.cs
│ ├── Consent
│ │ ├── ConsentController.cs
│ │ ├── ConsentInputModel.cs
│ │ ├── ConsentOptions.cs
│ │ ├── ConsentViewModel.cs
│ │ ├── ProcessConsentResult.cs
│ │ └── ScopeViewModel.cs
│ ├── Diagnostics
│ │ ├── DiagnosticsController.cs
│ │ └── DiagnosticsViewModel.cs
│ ├── Extensions.cs
│ ├── Grants
│ │ ├── GrantsController.cs
│ │ └── GrantsViewModel.cs
│ ├── Home
│ │ ├── ErrorViewModel.cs
│ │ └── HomeController.cs
│ ├── SecurityHeadersAttribute.cs
│ └── TestUsers.cs
├── Startup.cs
├── Views
│ ├── Account
│ │ ├── LoggedOut.cshtml
│ │ ├── Login.cshtml
│ │ └── Logout.cshtml
│ ├── Consent
│ │ ├── Index.cshtml
│ │ └── _ScopeListItem.cshtml
│ ├── Diagnostics
│ │ └── Index.cshtml
│ ├── Grants
│ │ └── Index.cshtml
│ ├── Home
│ │ └── Index.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ ├── Redirect.cshtml
│ │ ├── _Layout.cshtml
│ │ └── _ValidationSummary.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
└── wwwroot
│ ├── css
│ ├── site.css
│ ├── site.less
│ └── site.min.css
│ ├── favicon.ico
│ ├── icon.jpg
│ ├── icon.png
│ ├── js
│ ├── signin-redirect.js
│ └── signout-redirect.js
│ └── lib
│ ├── bootstrap
│ ├── css
│ │ ├── bootstrap.css
│ │ ├── bootstrap.css.map
│ │ └── bootstrap.min.css
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
│ └── js
│ │ ├── bootstrap.js
│ │ └── bootstrap.min.js
│ └── jquery
│ ├── jquery.js
│ ├── jquery.min.js
│ └── jquery.min.map
├── Blazor.Extensions.Oidc.Test.Server
├── Blazor.Extensions.Oidc.Test.Server.csproj
├── Controllers
│ └── SampleDataController.cs
├── Program.cs
├── Properties
│ └── launchSettings.json
└── Startup.cs
├── Blazor.Extensions.Oidc.Test.Shared
├── Blazor.Extensions.Oidc.Test.Shared.csproj
└── WeatherForecast.cs
└── global.json
/.gitignore:
--------------------------------------------------------------------------------
1 | tempkey.rsa
2 | authfix.blazor.extensions.oidc.js
3 |
4 | # Created by https://www.gitignore.io/api/csharp,visualstudio,visualstudiocode
5 |
6 | ### Csharp ###
7 | ## Ignore Visual Studio temporary files, build results, and
8 | ## files generated by popular Visual Studio add-ons.
9 | ##
10 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
11 |
12 | # User-specific files
13 | *.suo
14 | *.user
15 | *.userosscache
16 | *.sln.docstates
17 |
18 | # User-specific files (MonoDevelop/Xamarin Studio)
19 | *.userprefs
20 |
21 | # Build results
22 | [Dd]ebug/
23 | [Dd]ebugPublic/
24 | [Rr]elease/
25 | [Rr]eleases/
26 | x64/
27 | x86/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 |
33 | # Visual Studio 2015/2017 cache/options directory
34 | .vs/
35 | # Uncomment if you have tasks that create the project's static files in wwwroot
36 | #wwwroot/
37 |
38 | # Visual Studio 2017 auto generated files
39 | Generated\ Files/
40 |
41 | # MSTest test Results
42 | [Tt]est[Rr]esult*/
43 | [Bb]uild[Ll]og.*
44 |
45 | # NUNIT
46 | *.VisualState.xml
47 | TestResult.xml
48 |
49 | # Build Results of an ATL Project
50 | [Dd]ebugPS/
51 | [Rr]eleasePS/
52 | dlldata.c
53 |
54 | # Benchmark Results
55 | BenchmarkDotNet.Artifacts/
56 |
57 | # .NET Core
58 | project.lock.json
59 | project.fragment.lock.json
60 | artifacts/
61 |
62 | # StyleCop
63 | StyleCopReport.xml
64 |
65 | # Files built by Visual Studio
66 | *_i.c
67 | *_p.c
68 | *_i.h
69 | *.ilk
70 | *.meta
71 | *.obj
72 | *.iobj
73 | *.pch
74 | *.pdb
75 | *.ipdb
76 | *.pgc
77 | *.pgd
78 | *.rsp
79 | *.sbr
80 | *.tlb
81 | *.tli
82 | *.tlh
83 | *.tmp
84 | *.tmp_proj
85 | *.log
86 | *.vspscc
87 | *.vssscc
88 | .builds
89 | *.pidb
90 | *.svclog
91 | *.scc
92 |
93 | # Chutzpah Test files
94 | _Chutzpah*
95 |
96 | # Visual C++ cache files
97 | ipch/
98 | *.aps
99 | *.ncb
100 | *.opendb
101 | *.opensdf
102 | *.sdf
103 | *.cachefile
104 | *.VC.db
105 | *.VC.VC.opendb
106 |
107 | # Visual Studio profiler
108 | *.psess
109 | *.vsp
110 | *.vspx
111 | *.sap
112 |
113 | # Visual Studio Trace Files
114 | *.e2e
115 |
116 | # TFS 2012 Local Workspace
117 | $tf/
118 |
119 | # Guidance Automation Toolkit
120 | *.gpState
121 |
122 | # ReSharper is a .NET coding add-in
123 | _ReSharper*/
124 | *.[Rr]e[Ss]harper
125 | *.DotSettings.user
126 |
127 | # JustCode is a .NET coding add-in
128 | .JustCode
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # The packages folder can be ignored because of Package Restore
188 | **/[Pp]ackages/*
189 | # except build/, which is used as an MSBuild target.
190 | !**/[Pp]ackages/build/
191 | # Uncomment if necessary however generally it will be regenerated when needed
192 | #!**/[Pp]ackages/repositories.config
193 | # NuGet v3's project.json files produces more ignorable files
194 | *.nuget.props
195 | *.nuget.targets
196 |
197 | # Microsoft Azure Build Output
198 | csx/
199 | *.build.csdef
200 |
201 | # Microsoft Azure Emulator
202 | ecf/
203 | rcf/
204 |
205 | # Windows Store app package directories and files
206 | AppPackages/
207 | BundleArtifacts/
208 | Package.StoreAssociation.xml
209 | _pkginfo.txt
210 | *.appx
211 |
212 | # Visual Studio cache files
213 | # files ending in .cache can be ignored
214 | *.[Cc]ache
215 | # but keep track of directories ending in .cache
216 | !*.[Cc]ache/
217 |
218 | # Others
219 | ClientBin/
220 | ~$*
221 | *~
222 | *.dbmdl
223 | *.dbproj.schemaview
224 | *.jfm
225 | *.pfx
226 | *.publishsettings
227 | orleans.codegen.cs
228 |
229 | # Including strong name files can present a security risk
230 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
231 | #*.snk
232 |
233 | # Since there are multiple workflows, uncomment next line to ignore bower_components
234 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
235 | #bower_components/
236 |
237 | # RIA/Silverlight projects
238 | Generated_Code/
239 |
240 | # Backup & report files from converting an old project file
241 | # to a newer Visual Studio version. Backup files are not needed,
242 | # because we have git ;-)
243 | _UpgradeReport_Files/
244 | Backup*/
245 | UpgradeLog*.XML
246 | UpgradeLog*.htm
247 | ServiceFabricBackup/
248 | *.rptproj.bak
249 |
250 | # SQL Server files
251 | *.mdf
252 | *.ldf
253 | *.ndf
254 |
255 | # Business Intelligence projects
256 | *.rdl.data
257 | *.bim.layout
258 | *.bim_*.settings
259 | *.rptproj.rsuser
260 |
261 | # Microsoft Fakes
262 | FakesAssemblies/
263 |
264 | # GhostDoc plugin setting file
265 | *.GhostDoc.xml
266 |
267 | # Node.js Tools for Visual Studio
268 | .ntvs_analysis.dat
269 | node_modules/
270 |
271 | # Visual Studio 6 build log
272 | *.plg
273 |
274 | # Visual Studio 6 workspace options file
275 | *.opt
276 |
277 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
278 | *.vbw
279 |
280 | # Visual Studio LightSwitch build output
281 | **/*.HTMLClient/GeneratedArtifacts
282 | **/*.DesktopClient/GeneratedArtifacts
283 | **/*.DesktopClient/ModelManifest.xml
284 | **/*.Server/GeneratedArtifacts
285 | **/*.Server/ModelManifest.xml
286 | _Pvt_Extensions
287 |
288 | # Paket dependency manager
289 | .paket/paket.exe
290 | paket-files/
291 |
292 | # FAKE - F# Make
293 | .fake/
294 |
295 | # JetBrains Rider
296 | .idea/
297 | *.sln.iml
298 |
299 | # CodeRush
300 | .cr/
301 |
302 | # Python Tools for Visual Studio (PTVS)
303 | __pycache__/
304 | *.pyc
305 |
306 | # Cake - Uncomment if you are using it
307 | # tools/**
308 | # !tools/packages.config
309 |
310 | # Tabs Studio
311 | *.tss
312 |
313 | # Telerik's JustMock configuration file
314 | *.jmconfig
315 |
316 | # BizTalk build output
317 | *.btp.cs
318 | *.btm.cs
319 | *.odx.cs
320 | *.xsd.cs
321 |
322 | # OpenCover UI analysis results
323 | OpenCover/
324 |
325 | # Azure Stream Analytics local run output
326 | ASALocalRun/
327 |
328 | # MSBuild Binary and Structured Log
329 | *.binlog
330 |
331 | # NVidia Nsight GPU debugger configuration file
332 | *.nvuser
333 |
334 | # MFractors (Xamarin productivity tool) working folder
335 | .mfractor/
336 |
337 | ### VisualStudioCode ###
338 | .vscode/*
339 | !.vscode/settings.json
340 | !.vscode/tasks.json
341 | !.vscode/launch.json
342 | !.vscode/extensions.json
343 |
344 | ### VisualStudio ###
345 | ## Ignore Visual Studio temporary files, build results, and
346 | ## files generated by popular Visual Studio add-ons.
347 | ##
348 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
349 |
350 | # User-specific files
351 |
352 | # User-specific files (MonoDevelop/Xamarin Studio)
353 |
354 | # Build results
355 |
356 | # Visual Studio 2015/2017 cache/options directory
357 | # Uncomment if you have tasks that create the project's static files in wwwroot
358 | #wwwroot/
359 |
360 | # Visual Studio 2017 auto generated files
361 |
362 | # MSTest test Results
363 |
364 | # NUNIT
365 |
366 | # Build Results of an ATL Project
367 |
368 | # Benchmark Results
369 |
370 | # .NET Core
371 |
372 | # StyleCop
373 |
374 | # Files built by Visual Studio
375 |
376 | # Chutzpah Test files
377 |
378 | # Visual C++ cache files
379 |
380 | # Visual Studio profiler
381 |
382 | # Visual Studio Trace Files
383 |
384 | # TFS 2012 Local Workspace
385 |
386 | # Guidance Automation Toolkit
387 |
388 | # ReSharper is a .NET coding add-in
389 |
390 | # JustCode is a .NET coding add-in
391 |
392 | # TeamCity is a build add-in
393 |
394 | # DotCover is a Code Coverage Tool
395 |
396 | # AxoCover is a Code Coverage Tool
397 |
398 | # Visual Studio code coverage results
399 |
400 | # NCrunch
401 |
402 | # MightyMoose
403 |
404 | # Web workbench (sass)
405 |
406 | # Installshield output folder
407 |
408 | # DocProject is a documentation generator add-in
409 |
410 | # Click-Once directory
411 |
412 | # Publish Web Output
413 | # Note: Comment the next line if you want to checkin your web deploy settings,
414 | # but database connection strings (with potential passwords) will be unencrypted
415 |
416 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
417 | # checkin your Azure Web App publish settings, but sensitive information contained
418 | # in these scripts will be unencrypted
419 |
420 | # NuGet Packages
421 | # The packages folder can be ignored because of Package Restore
422 | # except build/, which is used as an MSBuild target.
423 | # Uncomment if necessary however generally it will be regenerated when needed
424 | #!**/[Pp]ackages/repositories.config
425 | # NuGet v3's project.json files produces more ignorable files
426 |
427 | # Microsoft Azure Build Output
428 |
429 | # Microsoft Azure Emulator
430 |
431 | # Windows Store app package directories and files
432 |
433 | # Visual Studio cache files
434 | # files ending in .cache can be ignored
435 | # but keep track of directories ending in .cache
436 |
437 | # Others
438 |
439 | # Including strong name files can present a security risk
440 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
441 | #*.snk
442 |
443 | # Since there are multiple workflows, uncomment next line to ignore bower_components
444 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
445 | #bower_components/
446 |
447 | # RIA/Silverlight projects
448 |
449 | # Backup & report files from converting an old project file
450 | # to a newer Visual Studio version. Backup files are not needed,
451 | # because we have git ;-)
452 |
453 | # SQL Server files
454 |
455 | # Business Intelligence projects
456 |
457 | # Microsoft Fakes
458 |
459 | # GhostDoc plugin setting file
460 |
461 | # Node.js Tools for Visual Studio
462 |
463 | # Visual Studio 6 build log
464 |
465 | # Visual Studio 6 workspace options file
466 |
467 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
468 |
469 | # Visual Studio LightSwitch build output
470 |
471 | # Paket dependency manager
472 |
473 | # FAKE - F# Make
474 |
475 | # JetBrains Rider
476 |
477 | # CodeRush
478 |
479 | # Python Tools for Visual Studio (PTVS)
480 |
481 | # Cake - Uncomment if you are using it
482 | # tools/**
483 | # !tools/packages.config
484 |
485 | # Tabs Studio
486 |
487 | # Telerik's JustMock configuration file
488 |
489 | # BizTalk build output
490 |
491 | # OpenCover UI analysis results
492 |
493 | # Azure Stream Analytics local run output
494 |
495 | # MSBuild Binary and Structured Log
496 |
497 | # NVidia Nsight GPU debugger configuration file
498 |
499 | # MFractors (Xamarin productivity tool) working folder
500 |
501 |
502 | # End of https://www.gitignore.io/api/csharp,visualstudio,visualstudiocode
--------------------------------------------------------------------------------
/.nuget/Authfix.Blazor.Extensions.Oidc.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Authfix.Blazor.Extensions.Oidc
5 | 1.0.0
6 |
7 | Authfix
8 |
9 | true
10 | https://github.com/Authfix/Blazor-Oidc/blob/develop/LICENSE
11 | https://github.com/Authfix/Blazor-Oidc
12 | The package aims to add the possibility to use oidc-client javascript library inside a Blazor project by using Blazor's interop capabilities.
13 | Add oidc-client library support for Blazor
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Blazor.Oidc.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2042
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Oidc.JS", "src\Blazor.Extensions.Oidc.JS\Blazor.Extensions.Oidc.JS.csproj", "{034FB1F5-7928-4B1C-9106-F6139F4B0446}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Oidc", "src\Blazor.Extensions.Oidc\Blazor.Extensions.Oidc.csproj", "{F61B04E1-DB22-42C8-92FA-DDE1C25E2E1B}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{FBED13AE-7A93-4B89-91FC-7F78E8ECADB3}"
11 | EndProject
12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{DB3DFB2D-9364-491E-B213-5255A63800B7}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Oidc.Test.Server", "test\Blazor.Extensions.Oidc.Test.Server\Blazor.Extensions.Oidc.Test.Server.csproj", "{08FA79FA-6F4B-4029-88C5-1655CE61F2D5}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Oidc.Test.Client", "test\Blazor.Extensions.Oidc.Test.Client\Blazor.Extensions.Oidc.Test.Client.csproj", "{F2ED9BFA-8E0C-454D-A70F-BC87EF6544E1}"
17 | EndProject
18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Oidc.Test.Shared", "test\Blazor.Extensions.Oidc.Test.Shared\Blazor.Extensions.Oidc.Test.Shared.csproj", "{D0E1A332-E04C-40D9-8CA9-B8E20648AE84}"
19 | EndProject
20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Oidc.Test.Identity", "test\Blazor.Extensions.Oidc.Test.Identity\Blazor.Extensions.Oidc.Test.Identity.csproj", "{B321F8EB-78F9-427D-BEF1-9C59F55A6006}"
21 | EndProject
22 | Global
23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 | Debug|Any CPU = Debug|Any CPU
25 | Release|Any CPU = Release|Any CPU
26 | EndGlobalSection
27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 | {034FB1F5-7928-4B1C-9106-F6139F4B0446}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {034FB1F5-7928-4B1C-9106-F6139F4B0446}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {034FB1F5-7928-4B1C-9106-F6139F4B0446}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {034FB1F5-7928-4B1C-9106-F6139F4B0446}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {F61B04E1-DB22-42C8-92FA-DDE1C25E2E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {F61B04E1-DB22-42C8-92FA-DDE1C25E2E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {F61B04E1-DB22-42C8-92FA-DDE1C25E2E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {F61B04E1-DB22-42C8-92FA-DDE1C25E2E1B}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {08FA79FA-6F4B-4029-88C5-1655CE61F2D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {08FA79FA-6F4B-4029-88C5-1655CE61F2D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {08FA79FA-6F4B-4029-88C5-1655CE61F2D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 | {08FA79FA-6F4B-4029-88C5-1655CE61F2D5}.Release|Any CPU.Build.0 = Release|Any CPU
40 | {F2ED9BFA-8E0C-454D-A70F-BC87EF6544E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {F2ED9BFA-8E0C-454D-A70F-BC87EF6544E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {F2ED9BFA-8E0C-454D-A70F-BC87EF6544E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {F2ED9BFA-8E0C-454D-A70F-BC87EF6544E1}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {D0E1A332-E04C-40D9-8CA9-B8E20648AE84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {D0E1A332-E04C-40D9-8CA9-B8E20648AE84}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {D0E1A332-E04C-40D9-8CA9-B8E20648AE84}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {D0E1A332-E04C-40D9-8CA9-B8E20648AE84}.Release|Any CPU.Build.0 = Release|Any CPU
48 | {B321F8EB-78F9-427D-BEF1-9C59F55A6006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {B321F8EB-78F9-427D-BEF1-9C59F55A6006}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {B321F8EB-78F9-427D-BEF1-9C59F55A6006}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {B321F8EB-78F9-427D-BEF1-9C59F55A6006}.Release|Any CPU.Build.0 = Release|Any CPU
52 | EndGlobalSection
53 | GlobalSection(SolutionProperties) = preSolution
54 | HideSolutionNode = FALSE
55 | EndGlobalSection
56 | GlobalSection(NestedProjects) = preSolution
57 | {034FB1F5-7928-4B1C-9106-F6139F4B0446} = {FBED13AE-7A93-4B89-91FC-7F78E8ECADB3}
58 | {F61B04E1-DB22-42C8-92FA-DDE1C25E2E1B} = {FBED13AE-7A93-4B89-91FC-7F78E8ECADB3}
59 | {08FA79FA-6F4B-4029-88C5-1655CE61F2D5} = {DB3DFB2D-9364-491E-B213-5255A63800B7}
60 | {F2ED9BFA-8E0C-454D-A70F-BC87EF6544E1} = {DB3DFB2D-9364-491E-B213-5255A63800B7}
61 | {D0E1A332-E04C-40D9-8CA9-B8E20648AE84} = {DB3DFB2D-9364-491E-B213-5255A63800B7}
62 | {B321F8EB-78F9-427D-BEF1-9C59F55A6006} = {DB3DFB2D-9364-491E-B213-5255A63800B7}
63 | EndGlobalSection
64 | GlobalSection(ExtensibilityGlobals) = postSolution
65 | SolutionGuid = {7E45CDD9-9817-451C-8431-5E420BFD2AC3}
66 | EndGlobalSection
67 | EndGlobal
68 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Thomas Bailly
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Oidc Blazor Extensions Oidc
2 |
3 | This package adds a [Oidc-client](https://github.com/IdentityModel/oidc-client-js) library for [Microsoft ASP.NET Blazor](https://github.com/aspnet/Blazor).
4 |
5 | The package aims to add the possibility to use oidc-client javascript library inside a Blazor project by using Blazor's interop capabilities.
6 |
7 | # Features
8 |
9 | This package *does not* implements all public features of the oidc-client library.
10 |
11 | > Note: Only basic authentication is available for now.
12 |
13 | # Sample usage
14 |
15 | The following snippet shows how to setup the oidc client and allow authentication.
16 |
17 | On the page where we want to begin the authentication process
18 |
19 | ```c#
20 | var config = new IdentityConfiguration
21 | {
22 | Authority = "http://localhost:50000",
23 | ClientId = "js",
24 | PostLogoutRedirectUri = "http://localhost:50001/index.html",
25 | RedirectUri = "http://localhost:50001/callback",
26 | ResponseType = "id_token token",
27 | Scope = "openid profile api1"
28 | };
29 |
30 | var manager = new UserManager(config);
31 | var user = await manager.GetUser();
32 |
33 | if(user == null)
34 | {
35 | await manager.SignIn();
36 | }
37 | else
38 | {
39 | // do anything
40 | }
41 | ```
42 |
43 | And on the callback page
44 |
45 | ```c#
46 | var manager = new UserManager(config);
47 | await manager.SignInRedirectCallback();
48 | ```
49 |
50 | # Contributions and feedback
51 |
52 | Please feel free to use the component, open issues, fix bugs or provide feedback.
53 |
54 | # Contributors
55 |
56 | The following people are the maintainers of the project:
57 |
58 | - [Thomas Bailly](https://github.com/authfix)
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | install:
2 | - choco install gitversion.portable -pre -y
3 |
4 | assembly_info:
5 | patch: false
6 |
7 | before_build:
8 | - dotnet restore
9 | - ps: gitversion /l console /output buildserver /updateAssemblyInfo
10 |
11 | build_script:
12 | - ps: dotnet build src/Blazor.Extensions.Oidc.JS/Blazor.Extensions.Oidc.JS.csproj --configuration release --no-restore
13 | - ps: dotnet build src/Blazor.Extensions.Oidc/Blazor.Extensions.Oidc.csproj --configuration release --no-restore
14 |
15 | after_build:
16 | - cmd: nuget pack .nuget/Authfix.Blazor.Extensions.Oidc.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
17 |
18 | artifacts:
19 | - path: '*.nupkg'
20 | name: Authfix.Blazor.Extensions.Oidc
21 |
22 | branches:
23 | only:
24 | - master
--------------------------------------------------------------------------------
/src/Blazor.Extensions.Oidc.JS/Blazor.Extensions.Oidc.JS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Library
6 | false
7 | false
8 | false
9 | latest
10 | true
11 | Latest
12 | ${DefaultItemExcludes};dist\**;node_modules\**
13 |
14 |
15 | true
16 | Authfix.Blazor.Extensions.Oidc.JS
17 | Authfix.Blazor.Extensions.Oidc.JS
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/Blazor.Extensions.Oidc.JS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Authfix.Blazor.Extensions.Oidc.JS")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("Oidc extension for Blazor applications")]
12 | [assembly: AssemblyCopyright("Copyright © 2018")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("5f15ee16-bcbf-4ae0-8f98-5fef0ee4d670")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | [assembly: AssemblyVersion("1.0.0.0")]
32 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/src/Blazor.Extensions.Oidc.JS/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.0.1",
3 | "name": "authfix.blazor.extensions.oidc",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "dependencies": {
10 | "oidc-client": "1.5.2"
11 | },
12 | "devDependencies": {
13 | "@types/emscripten": "0.0.31",
14 | "typescript": "^2.6.1",
15 | "webpack": "^3.8.1",
16 | "ts-loader": "^3.2.0"
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Blazor.Extensions.Oidc.JS/src/BlazorTypes.ts:
--------------------------------------------------------------------------------
1 | // Declare types here until we've Blazor.d.ts
2 | export interface System_Object { System_Object__DO_NOT_IMPLEMENT: any };
3 | export interface System_String extends System_Object { System_String__DO_NOT_IMPLEMENT: any }
4 |
5 | export interface Platform {
6 | toJavaScriptString(dotNetString: System_String): string;
7 | }
8 |
9 | export type BlazorType = {
10 | registerFunction(identifier: string, implementation: Function),
11 | platform: Platform
12 | };
--------------------------------------------------------------------------------
/src/Blazor.Extensions.Oidc.JS/src/BlazorUserManager.ts:
--------------------------------------------------------------------------------
1 | import { BlazorType } from "./BlazorTypes";
2 | import * as Oidc from "oidc-client";
3 | import { UserManagerSettings } from "oidc-client";
4 |
5 | export class BlazorUserManager {
6 |
7 | public static initialize() {
8 | const Blazor: BlazorType = window["Blazor"];
9 |
10 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.Init', (configuration: any) => {
11 |
12 | var localConfiguration: UserManagerSettings =
13 | {
14 | authority: configuration.authority,
15 | client_id: configuration.clientId,
16 | redirect_uri: configuration.redirectUri,
17 | response_type: configuration.responseType,
18 | scope: configuration.scope,
19 | post_logout_redirect_uri: configuration.postLogoutRedirectUri
20 | }
21 |
22 | window["BlazorExtensions"].UserManager = new Oidc.UserManager(localConfiguration);
23 | });
24 |
25 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.ClearStaleState', () => {
26 | return window["BlazorExtensions"].UserManager.clearStaleState();
27 | });
28 |
29 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.GetUser', () => {
30 | return window["BlazorExtensions"].UserManager.getUser();
31 | });
32 |
33 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.StoreUser', (userToStore: Oidc.User) => {
34 | return window["BlazorExtensions"].UserManager.storeUser(userToStore);
35 | });
36 |
37 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.RemoveUser', () => {
38 | return window["BlazorExtensions"].UserManager.removeUser();
39 | });
40 |
41 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignInPopup', (args?: any) => {
42 | return window["BlazorExtensions"].UserManager.signinPopup(args);
43 | });
44 |
45 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignInPopupCallback', (url?: string) => {
46 | return window["BlazorExtensions"].UserManager.signinPopupCallback(url);
47 | });
48 |
49 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignInSilent', (args?: any) => {
50 | return window["BlazorExtensions"].UserManager.signinSilent(args);
51 | });
52 |
53 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignInSilentCallback', (url?: string) => {
54 | return window["BlazorExtensions"].UserManager.signinSilentCallback(url);
55 | });
56 |
57 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignInRedirect', (args?: any) => {
58 | return window["BlazorExtensions"].UserManager.signinRedirect(args);
59 | });
60 |
61 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignInRedirectCallback', (url?: string) => {
62 | console.log("Url : " + url);
63 | return window["BlazorExtensions"].UserManager.signinRedirectCallback(url);
64 | });
65 |
66 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignOutPopup', (args?: any) => {
67 | return window["BlazorExtensions"].UserManager.signoutPopup(args);
68 | });
69 |
70 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.SignOutPopupCallback', (url?: string, keepOpen?: boolean) => {
71 | return window["BlazorExtensions"].UserManager.signoutPopupCallback(url, keepOpen);
72 | });
73 |
74 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.QuerySessionStatus', (args?: any) => {
75 | return window["BlazorExtensions"].UserManager.querySessionStatus(args);
76 | });
77 |
78 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.RevokeAccessToken', () => {
79 | return window["BlazorExtensions"].UserManager.revokeAccessToken();
80 | });
81 |
82 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.StartSilentRenew', () => {
83 | return window["BlazorExtensions"].UserManager.startSilentRenew();
84 | });
85 |
86 | Blazor.registerFunction('Authfix.Blazor.Extensions.Oidc.StopSilentRenew', () => {
87 | return window["BlazorExtensions"].UserManager.stopSilentRenew();
88 | });
89 | }
90 |
91 | }
--------------------------------------------------------------------------------
/src/Blazor.Extensions.Oidc.JS/src/GlobalExports.ts:
--------------------------------------------------------------------------------
1 | if (typeof window !== 'undefined' && !window['BlazorExtensions']) {
2 | // When the library is loaded in a browser via a
15 |