# AngularASPNETCoreOAuth
Sample project based on <a href="https://fullstackmark.com/post/21/user-authentication-and-identity-with-angular-aspnet-core-and-identityserver">the blog post</a> demonstrating how to build out an <a href="https://oauth.net/2/grant-types/implicit/" target="_blank">Implicit Grant</a> OAuth flow utilizing OAuth2/OpenID Connect protocols implementing IdentityServer4 as our OpenID Connect Provider and then using it to authenticate an Angular SPA client to authorize access to an independent ASP.NET Core Web API.
<img src="https://fullstackmark.com/img/posts/21/open-id-connect-oauth-flow-angular-aspnet-core-identityserver.gif" />
## Development Environment
- Visual Studio 2019 Community
- Visual Studio Code 1.32.3
- .NET Core SDK 3.1
- Angular 8
- IdentityServer4 3.0.1
- SQL Server Express 2016 LocalDB
## Setup
#### To run the demo:
**1.** Clone/Fork/Download this repository.
**2.** Create the database on your SQL Server Express LocalDB by using the dotnet cli to run the migrations from within the AuthServer.Infrastrucuture project folder.
<pre><code>AuthServer.Infrastructure> dotnet ef database update --context AppIdentityDbContext</code></pre>
<pre><code>AuthServer.Infrastructure> dotnet ef database update --context PersistedGrantDbContext</code></pre>
**3.** Install Angular CLI if necessary. `npm install -g @angular/cli`
**4.** Install Angular SPA dependencies.
<pre><code>Spa\oauth-client> npm install</code></pre>
**5.** Run the Angular CLI dev server to build and run the Angular app.
<pre><code>Spa\oauth-client> ng serve</code></pre>
- **Important:** This must be running on the default http://localhost:4200
**6.** Build/Run the `AuthServer.sln` solution using your preferred method: Visual Studio, VSCode, dotnet CLI.
- **Important:** This must be running on http://localhost:5000
**7.** Build/Run the `Resource.Api.sln` solution using your preferred method: Visual Studio, VSCode, dotnet CLI.
- **Important:** This must be running on http://localhost:5050
**8.** Point a browser to `http://localhost:4200` to access the Angular client.
**9.** Use the *Signup* and *Login* functions to perform the authentication flow, then try and access the *Top Secret Area* to hit the protected ASP.NET Core Web API.
## Contact
mark@fullstackmark.com
没有合适的资源?快使用搜索试试~ 我知道了~
AngularASPNETCoreOAuth:示例项目演示了如何使用Angular,Asp.Net Core和IdentityS...
共186个文件
ts:48个
cs:39个
js:15个
5星 · 超过95%的资源 需积分: 12 1 下载量 189 浏览量
2021-01-31
07:22:43
上传
评论
收藏 1.06MB ZIP 举报
温馨提示
AngularASPNETCoreOAuth 基于示例项目,展示了如何利用将IdentityServer4作为我们的OpenID Connect提供程序的OAuth2 / OpenID Connect协议构建OAuth流,然后使用它来认证Angular SPA客户端以授权对独立ASP.NET Core的访问Web API。 开发环境 Visual Studio 2019社区 Visual Studio代码1.32.3 .NET Core SDK 3.1 角度8 IdentityServer4 3.0.1 SQL Server Express 2016本地数据库 建立 要运行演示: 1.克隆/叉/下载此存储库。 2.使用dotnet cli在AuthServer.Infrastrucuture项目文件夹中运行迁移,从而在SQL Server Express LocalDB上创建数据库。 AuthServer.Infrastructure> dotnet ef database update --context AppIdentityDbContext AuthServe
资源详情
资源评论
资源推荐
收起资源包目录
AngularASPNETCoreOAuth:示例项目演示了如何使用Angular,Asp.Net Core和IdentityServer4进行用户身份验证和身份验证 (186个子文件)
browserslist 388B
AccountController.cs 11KB
ConsentController.cs 10KB
20190403041320_initial.cs 10KB
20190403041320_initial.Designer.cs 8KB
AppIdentityDbContextModelSnapshot.cs 8KB
Startup.cs 5KB
20190403041351_initial.Designer.cs 3KB
PersistedGrantDbContextModelSnapshot.cs 3KB
SecurityHeadersAttribute.cs 3KB
20190403041351_initial.cs 3KB
DesignTimeDbContextFactoryBase.cs 2KB
Startup.cs 2KB
IdentityClaimsProfileService.cs 2KB
Config.cs 1KB
HomeController.cs 1KB
AppIdentityDbContext.cs 956B
PersistedGrantDbContextFactory.cs 932B
AccountOptions.cs 842B
LoginViewModel.cs 776B
IClientStoreExtensions.cs 773B
RegisterRequestViewModel.cs 740B
ValuesController.cs 568B
ProcessConsentResult.cs 559B
ConsentOptions.cs 536B
ConsentViewModel.cs 479B
Program.cs 469B
Program.cs 467B
RegisterResponseViewModel.cs 424B
HttpResponseExtensions.cs 415B
AppIdentityDbContextFactory.cs 395B
LoginInputModel.cs 348B
ScopeViewModel.cs 347B
ConsentInputModel.cs 322B
_ScopeListItem.cshtml.cs 319B
Index.cshtml.cs 311B
AppUser.cs 292B
ExternalProvider.cs 188B
Roles.cs 148B
RedirectViewModel.cs 132B
_Layout.cshtml 4KB
Login.cshtml 2KB
Index.cshtml 2KB
_ValidationScriptsPartial.cshtml 1KB
_CookieConsentPartial.cshtml 1KB
_ScopeListItem.cshtml 717B
Index.cshtml 253B
_ValidationSummary.cshtml 156B
Privacy.cshtml 138B
_ViewImports.cshtml 81B
_ViewStart.cshtml 32B
AuthServer.Infrastructure.csproj 901B
AuthServer.csproj 843B
Resource.Api.csproj 424B
bootstrap.css 170KB
bootstrap.min.css 138KB
bootstrap-grid.css 37KB
bootstrap-grid.min.css 28KB
bootstrap-reboot.css 5KB
bootstrap-reboot.min.css 4KB
site.css 1KB
.editorconfig 246B
.gitignore 5KB
.gitignore 5KB
.gitignore 629B
.gitkeep 0B
register.component.html 2KB
index.component.html 881B
header.component.html 773B
login.component.html 679B
index.html 651B
index.component.html 515B
auth-callback.component.html 277B
shell.component.html 119B
app.component.html 32B
favicon.ico 31KB
favicon.ico 5KB
jquery.js 265KB
bootstrap.bundle.js 207KB
bootstrap.js 121KB
jquery.min.js 85KB
bootstrap.bundle.min.js 69KB
bootstrap.min.js 50KB
jquery.validate.js 48KB
additional-methods.js 41KB
jquery.validate.min.js 23KB
jquery.validate.unobtrusive.js 19KB
additional-methods.min.js 18KB
jquery.validate.unobtrusive.min.js 6KB
karma.conf.js 1KB
protractor.conf.js 752B
site.js 226B
package-lock.json 461KB
angular.json 4KB
tslint.json 2KB
package.json 1KB
tsconfig.json 435B
tsconfig.spec.json 256B
appsettings.json 249B
tslint.json 244B
共 186 条
- 1
- 2
文清的男友
- 粉丝: 26
- 资源: 4654
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1