-
Notifications
You must be signed in to change notification settings - Fork 1k
Jmprieur/webappwebapib2c #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8c158dd
Experiment for a B2C Web app calling a B2C Web API.
jmprieur ab84785
Test and fix B2C web app calls web api scenario
jennyf19 ad68fd0
Merge branch 'jmprieur/removingUis' into jmprieur/webappwebapib2c
jmprieur 3a51a6a
Fixing missing references
jmprieur b23fc76
Uncommenting a needed line
jmprieur f40c079
Merge branch 'jennyf/b2cwebapi' into jmprieur/webappwebapib2c
jmprieur b931371
Merge pull request #286 from Azure-Samples/jmprieur/webappwebapib2c
jennyf19 5cc9253
Fixing a build break
jmprieur 9e83c74
Merging
jmprieur 81c281e
Fixing the configuration and a problem brought bad a by merge by jmpr…
jmprieur 2962513
add uitid to the claims for b2c
jennyf19 41c3eae
Merge branch 'jennyf/b2cwebapi' of https://github.com/Azure-Samples/a…
jennyf19 cae8c19
Merge pull request #296 from Azure-Samples/jennyf/b2cwebapi
jennyf19 2862a71
moving Web app calling Web API with B2C in own folder
jmprieur e0d78fd
Reading the 4-1-MyOrg folder
jmprieur f07deb6
Merge branch 'jmprieur/removingUis' into jmprieur/webappwebapib2c
jmprieur aaef4c9
Update README.md
jennyf19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
974 changes: 974 additions & 0 deletions
974
4-WebApp-your-API/4-1-MyOrg/.vs/WebApp-Calls-WebAPI-MyOrg/config/applicationhost.config
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
31 changes: 31 additions & 0 deletions
31
4-WebApp-your-API/4-2-B2C/Client/Controllers/HomeController.cs
This file contains hidden or 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,31 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Identity.Web; | ||
using System.Diagnostics; | ||
using WebApp_OpenIDConnect_DotNet.Models; | ||
|
||
namespace WebApp_OpenIDConnect_DotNet.Controllers | ||
{ | ||
[Authorize] | ||
public class HomeController : Controller | ||
{ | ||
private readonly ITokenAcquisition tokenAcquisition; | ||
|
||
public HomeController(ITokenAcquisition tokenAcquisition) | ||
{ | ||
this.tokenAcquisition = tokenAcquisition; | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
[AllowAnonymous] | ||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | ||
public IActionResult Error() | ||
{ | ||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); | ||
} | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
4-WebApp-your-API/4-2-B2C/Client/Controllers/TodoListController.cs
This file contains hidden or 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,92 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Identity.Web; | ||
using System.Threading.Tasks; | ||
using TodoListClient.Services; | ||
using TodoListService.Models; | ||
|
||
namespace TodoListClient.Controllers | ||
{ | ||
public class TodoListController : Controller | ||
{ | ||
private ITodoListService _todoListService; | ||
|
||
public TodoListController(ITodoListService todoListService) | ||
{ | ||
_todoListService = todoListService; | ||
} | ||
|
||
// GET: TodoList | ||
[AuthorizeForScopes(ScopeKeySection = "TodoList:TodoListScope")] | ||
public async Task<ActionResult> Index() | ||
{ | ||
return View(await _todoListService.GetAsync()); | ||
} | ||
|
||
// GET: TodoList/Details/5 | ||
public async Task<ActionResult> Details(int id) | ||
{ | ||
return View(await _todoListService.GetAsync(id)); | ||
} | ||
|
||
// GET: TodoList/Create | ||
public ActionResult Create() | ||
{ | ||
Todo todo = new Todo() { Owner = HttpContext.User.Identity.Name }; | ||
return View(todo); | ||
} | ||
|
||
// POST: TodoList/Create | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public async Task<ActionResult> Create([Bind("Title,Owner")] Todo todo) | ||
{ | ||
await _todoListService.AddAsync(todo); | ||
return RedirectToAction("Index"); | ||
} | ||
|
||
// GET: TodoList/Edit/5 | ||
public async Task<ActionResult> Edit(int id) | ||
{ | ||
Todo todo = await this._todoListService.GetAsync(id); | ||
|
||
if (todo == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
return View(todo); | ||
} | ||
|
||
// POST: TodoList/Edit/5 | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public async Task<ActionResult> Edit(int id, [Bind("Id,Title,Owner")] Todo todo) | ||
{ | ||
await _todoListService.EditAsync(todo); | ||
return RedirectToAction("Index"); | ||
} | ||
|
||
// GET: TodoList/Delete/5 | ||
public async Task<ActionResult> Delete(int id) | ||
{ | ||
Todo todo = await this._todoListService.GetAsync(id); | ||
|
||
if (todo == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
return View(todo); | ||
} | ||
|
||
// POST: TodoList/Delete/5 | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public async Task<ActionResult> Delete(int id, [Bind("Id,Title,Owner")] Todo todo) | ||
{ | ||
await _todoListService.DeleteAsync(id); | ||
return RedirectToAction("Index"); | ||
} | ||
} | ||
} |
This file contains hidden or 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,8 @@ | ||
namespace WebApp_OpenIDConnect_DotNet.Infrastructure | ||
{ | ||
public static class Constants | ||
{ | ||
public const string ScopeUserImpersonation = "user_impersonation"; | ||
public const string BearerAuthorizationScheme = "Bearer"; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
header info....do we even use these?