-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add full OAuth2 flows and login UI #62
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 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7f50a3e
feat: add first version of login UI
jeastham1993 b86caf7
feat: add OAuth 2 implementation
jeastham1993 07c4041
fix: remove redundant Bootstrap static assets
jeastham1993 349a3b7
chore: update auth docs
jeastham1993 b0bcd6b
feat: resolve integration test issues
jeastham1993 13f4e28
Delete .github/.DS_Store
jeastham1993 543f143
Delete .DS_Store
jeastham1993 82a2d23
chore: fix integrationt test issues
jeastham1993 803570d
chore: remove redundant integration test
jeastham1993 63a98af
Merge branch 'feat/add-login-ui' of github.com:DataDog/stickerlandia …
jeastham1993 9e79b68
chore: update docs for auth controller
jeastham1993 a42f981
chore: update integration tests to remove consent and HTML parsing
jeastham1993 63b2787
chore: cleanup code
jeastham1993 0798a43
chore: readd user updated event publish
jeastham1993 3681b8c
fix: resolve test issue
jeastham1993 66041d7
chore: update docs and endpoints
jeastham1993 998bfb6
feat: update login/register page paths
jeastham1993 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
Binary file not shown.
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
66 changes: 66 additions & 0 deletions
66
...ent/src/Stickerlandia.UserManagement.Api/Areas/Identity/Pages/Account/AccessDenied.cshtml
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,66 @@ | ||
| @page | ||
| @model AccessDeniedModel | ||
| @{ | ||
| ViewData["Title"] = "Access denied"; | ||
| } | ||
|
|
||
| <div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8"> | ||
| <div class="sm:mx-auto sm:w-full sm:max-w-md"> | ||
| <img src="https://tailwindcss.com/plus-assets/img/logos/mark.svg?color=indigo&shade=600" | ||
| alt="Stickerlandia Logo" | ||
| class="mx-auto h-10 w-auto"/> | ||
| <h2 class="mt-10 text-center text-2xl/9 font-bold tracking-tight text-gray-900">Access denied</h2> | ||
| </div> | ||
|
|
||
| <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-md"> | ||
| <div class="text-center space-y-6"> | ||
| <div class="rounded-md bg-red-50 p-4"> | ||
| <div class="flex"> | ||
| <div class="flex-shrink-0"> | ||
| <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||
| <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" /> | ||
| </svg> | ||
| </div> | ||
| <div class="ml-3"> | ||
| <h3 class="text-sm font-medium text-red-800"> | ||
| Access Denied | ||
| </h3> | ||
| <div class="mt-2 text-sm text-red-700"> | ||
| <p>You do not have permission to access this resource. This could be because:</p> | ||
| <ul class="list-disc list-inside mt-2 space-y-1"> | ||
| <li>You are not signed in</li> | ||
| <li>Your account doesn't have the required permissions</li> | ||
| <li>The resource you're trying to access has been restricted</li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="space-y-4"> | ||
| <div> | ||
| <a asp-page="./Login" | ||
| class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm/6 font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"> | ||
| Sign in | ||
| </a> | ||
| </div> | ||
| <div> | ||
| <a href="/" | ||
| class="flex w-full justify-center rounded-md bg-white px-3 py-1.5 text-sm/6 font-semibold text-gray-900 outline-1 -outline-offset-1 outline-gray-300 hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"> | ||
| Go to home page | ||
| </a> | ||
| </div> | ||
| <div> | ||
| <button onclick="history.back()" | ||
| class="flex w-full justify-center rounded-md bg-white px-3 py-1.5 text-sm/6 font-semibold text-gray-900 outline-1 -outline-offset-1 outline-gray-300 hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"> | ||
| Go back | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="text-sm text-gray-500"> | ||
| <p>If you believe this is an error, please contact support.</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> |
25 changes: 25 additions & 0 deletions
25
.../src/Stickerlandia.UserManagement.Api/Areas/Identity/Pages/Account/AccessDenied.cshtml.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,25 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| #nullable disable | ||
|
|
||
| #pragma warning disable CA1515 | ||
|
|
||
| using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
|
||
| namespace Stickerlandia.UserManagement.Api.Areas.Identity.Pages.Account | ||
| { | ||
| /// <summary> | ||
| /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used | ||
| /// directly from your code. This API may change or be removed in future releases. | ||
| /// </summary> | ||
| public class AccessDeniedModel : PageModel | ||
| { | ||
| /// <summary> | ||
| /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used | ||
| /// directly from your code. This API may change or be removed in future releases. | ||
| /// </summary> | ||
| public void OnGet() | ||
| { | ||
| } | ||
| } | ||
| } |
84 changes: 84 additions & 0 deletions
84
...management/src/Stickerlandia.UserManagement.Api/Areas/Identity/Pages/Account/Login.cshtml
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,84 @@ | ||
| @page | ||
| @model LoginModel | ||
|
|
||
| @{ | ||
| ViewData["Title"] = "Log in"; | ||
| } | ||
|
|
||
| <div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8"> | ||
| <div class="sm:mx-auto sm:w-full sm:max-w-sm"> | ||
| <img src="~/img/dd_logo_v_rgb.png" alt="Datadog Logo" | ||
| class="mx-auto h-10 w-auto"/> | ||
| <h2 class="mt-10 text-center text-2xl/9 font-bold tracking-tight text-gray-900">Sign in to your account</h2> | ||
| </div> | ||
|
|
||
| <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm"> | ||
| <form id="account" method="post" class="space-y-6"> | ||
| <div> | ||
| <div asp-validation-summary="ModelOnly" class="text-danger" role="alert"></div> | ||
| <label asp-for="Input.Email" class="block text-sm/6 font-medium text-gray-900">Email</label> | ||
| <div class="mt-2"> | ||
| <input asp-for="Input.Email" | ||
| class="block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6" | ||
| autocomplete="username" aria-required="true" placeholder="name@example.com"/> | ||
| <span asp-validation-for="Input.Email" class="text-danger"></span> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div> | ||
| <div class="flex items-center justify-between"> | ||
|
|
||
| <label asp-for="Input.Password" class="block text-sm/6 font-medium text-gray-900">Password</label> | ||
| <div class="text-sm"> | ||
| <a id="forgot-password" asp-page="./ForgotPassword" | ||
| class="font-semibold text-indigo-600 hover:text-indigo-500">Forgot your password?</a> | ||
| </div> | ||
| </div> | ||
| <div class="mt-2"> | ||
| <input asp-for="Input.Password" | ||
| class="block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6" | ||
| autocomplete="current-password" | ||
| aria-required="true" placeholder="password"/> | ||
| <span asp-validation-for="Input.Password" class="text-danger"></span> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div> | ||
| <button id="login-submit" | ||
| type="submit" | ||
| class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm/6 font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"> | ||
| Sign in | ||
| </button> | ||
| </div> | ||
| </form> | ||
|
|
||
| <p class="mt-10 text-center text-sm/6 text-gray-500"> | ||
| Not a member? | ||
| <a asp-page="./Register" class="font-semibold text-indigo-600 hover:text-indigo-500" | ||
| asp-route-returnUrl="@Model.ReturnUrl">Register as a new user</a> | ||
| </p> | ||
| </div> | ||
| <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm"> | ||
| @{ | ||
| if ((Model.ExternalLogins?.Count ?? 0) > 0) | ||
| { | ||
| <form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" | ||
| method="post" class="space-y-6"> | ||
| <div> | ||
| <p> | ||
| @foreach (var provider in Model.ExternalLogins!) | ||
| { | ||
| <button type="submit" class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm/6 font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" name="provider" value="@provider.Name" | ||
| title="Log in using your @provider.DisplayName account">@provider.DisplayName</button> | ||
| } | ||
| </p> | ||
| </div> | ||
| </form> | ||
| } | ||
| } | ||
| </div> | ||
| </div> | ||
| @* *@ | ||
| @* @section Scripts { *@ | ||
| @* <partial name="_ValidationScriptsPartial" /> *@ | ||
| @* } *@ |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.