-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated api to use bear token security
- Loading branch information
Jared Mahan
committed
Apr 29, 2018
1 parent
86ffcca
commit accaaab
Showing
5 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Authorization; | ||
using IdentityServer4.AccessTokenValidation; | ||
|
||
[Route ("api/identity")] | ||
[ApiController] | ||
|
||
[Authorize (AuthenticationSchemes = IdentityServerAuthenticationDefaults.AuthenticationScheme)] | ||
public class IdentityController : ControllerBase { | ||
[HttpGet] | ||
public IActionResult Get () { | ||
return new JsonResult (User.Claims.Select (c => new { c.Type, c.Value })); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-preview2-final" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0-preview2-final" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0-preview2-final" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.4.0" /> | ||
</ItemGroup> | ||
|
||
|
||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.6.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-preview2-final" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0-preview2-final" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0-preview2-final" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.4.0" /> | ||
</ItemGroup> | ||
|
||
|
||
</Project> |