-
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.
Added a new component called Component1.razor which is defined in the Dgmjr.Blazor.Components library. ADDED: Component1.razor.css - Added a new CSS file called Component1.razor.css that styles the Component1 component. ADDED: Dgmjr.Blazor.Components.csproj - Added a new project file called Dgmjr.Blazor.Components.csproj. ADDED: EnumerationSelectList.cs - Added a new class called EnumerationSelectList<TEnumeration, TIEnumeration> which is a dropdown list component. ADDED: ExampleJsInterop.cs - Added a new class called ExampleJsInterop that provides an example of how JavaScript functionality can be wrapped in a .NET class. ADDED: LICENSE.md Added a new license file called LICENSE.md. ADDED: UnknownYesNoSelectList.cs - Added a new class called UnknownYesNoSelectList which is a dropdown list component with options for unknown, yes, and no. ADDED: _Imports.razor - Added a new file called _Imports.razor that imports the Microsoft.AspNetCore.Components.Web namespace. ADDED: icon.png - Added a new image file called icon.png. ADDED: wwwroot/background.png - Added a new image file called background.png in the wwwroot folder. ADDED: wwwroot/exampleJs.js - Added a JavaScript file called exampleJsInterop.js in wwwroot folder. UPDATED: BlazorSecurityConstants.cs - Added new constant strings for account controller URIs. UPDATED: AccountController.cs - Added HTTP endpoints for login and logout AccountControllerUPDATED: ApplicationAuthenticationState.cs - Updated the ApplicationAuthenticationState class to be a readonly record struct. UPDATED: ApplicationUser.cs - Removed unused using statements in the ApplicationUser class. UPDATED: SecurityServiceCollectionExtensions.cs the Add toazorService. UPDATED: ApplicationAuthenticationStateProvider.cs - Added a using statement for the Dgmjr.Blazor.Services namespace. UPDATED: SecurityService- Added new using statements for the Radzen namespace. - Replaced hardcoded URIs with the Uris class. - Added XML documentation to the Security.
- Loading branch information
Showing
18 changed files
with
206 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="my-component"> | ||
This component is defined in the <strong>Dgmjr.Blazor.Components</strong> library. | ||
</div> |
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,6 @@ | ||
.my-component { | ||
border: 2px dashed red; | ||
padding: 1em; | ||
margin: 1em 0; | ||
background-image: url('background.png'); | ||
} |
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,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<TargetFrameworks>net8.0</TargetFrameworks> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup> | ||
<SupportedPlatform Include="browser" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" /> | ||
<PackageReference Include="Blazorise.Components" /> | ||
<PackageReference Include="Dgmjr.Abstractions" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageFile Include="./icon.png" /> | ||
<PackageFile Include="./bin/$(Configuration)/$(TargetFramework)/*.*" PackagePath="lib/$(TargetFramework)/%(Filename)%(Extension)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,14 @@ | ||
namespace Dgmjr.Blazor.Components; | ||
using System.Linq; | ||
using System.Collections; | ||
|
||
public class EnumerationSelectList<TEnumeration, TIEnumeration> : Blazorise.Components.DropdownList<TIEnumeration, string> | ||
where TIEnumeration : IHaveAShortName, IHaveADisplayName | ||
{ | ||
public EnumerationSelectList() | ||
{ | ||
this.Data = (typeof(TEnumeration).GetMethod("GetAll").Invoke(null, null) as IEnumerable).OfType<TIEnumeration>().ToList(); | ||
this.TextField = item => item.DisplayName; | ||
this.ValueField = item => item.ShortName; | ||
} | ||
} |
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,36 @@ | ||
// using Microsoft.JSInterop; | ||
|
||
// namespace Dgmjr.Blazor.Components; | ||
|
||
// // This class provides an example of how JavaScript functionality can be wrapped | ||
// // in a .NET class for easy consumption. The associated JavaScript module is | ||
// // loaded on demand when first needed. | ||
// // | ||
// // This class can be registered as scoped DI service and then injected into Blazor | ||
// // components for use. | ||
|
||
// public class ExampleJsInterop : IAsyncDisposable | ||
// { | ||
// private readonly Lazy<Task<IJSObjectReference>> moduleTask; | ||
|
||
// public ExampleJsInterop(IJSRuntime jsRuntime) | ||
// { | ||
// moduleTask = new (() => jsRuntime.InvokeAsync<IJSObjectReference>( | ||
// "import", "./_content/Dgmjr.Blazor.Components/exampleJsInterop.js").AsTask()); | ||
// } | ||
|
||
// public async ValueTask<string> Prompt(string message) | ||
// { | ||
// var module = await moduleTask.Value; | ||
// return await module.InvokeAsync<string>("showPrompt", message); | ||
// } | ||
|
||
// public async ValueTask DisposeAsync() | ||
// { | ||
// if (moduleTask.IsValueCreated) | ||
// { | ||
// var module = await moduleTask.Value; | ||
// await module.DisposeAsync(); | ||
// } | ||
// } | ||
// } |
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,35 @@ | ||
--- | ||
date: 2023-07-13T05:44:46:00-05:00Z | ||
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda... | ||
keywords: | ||
- IP | ||
- copyright | ||
- license | ||
- mit | ||
permissions: | ||
- commercial-use | ||
- modifications | ||
- distribution | ||
- private-use | ||
conditions: | ||
- include-copyright | ||
limitations: | ||
- liability | ||
- warranty | ||
lastmod: 2024-01-0T00:39:00.0000+05:00Z | ||
license: MIT | ||
slug: mit-license | ||
title: MIT License | ||
type: license | ||
--- | ||
|
||
# MIT License | ||
|
||
## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
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,45 @@ | ||
namespace Dgmjr.Blazor.Components; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
public class UnknownYesNoSelectList : Blazorise.Components.DropdownList<bool?, bool?> | ||
{ | ||
[Parameter] | ||
public string UnknownText { get; set; } = "Unknown"; | ||
[Parameter] | ||
public string YesText { get; set; } = "Yes"; | ||
[Parameter] | ||
public string NoText { get; set; } = "No"; | ||
|
||
public UnknownYesNoSelectList() | ||
{ | ||
Data = new[] { (bool?)null, true, false }; | ||
TextField = item => | ||
item switch | ||
{ | ||
null => UnknownText, | ||
true => YesText, | ||
false => NoText | ||
}; | ||
ValueField = item => item; | ||
} | ||
|
||
public virtual string SelectedValueString | ||
{ | ||
get => SelectedValue switch | ||
{ | ||
null => UnknownText, | ||
true => YesText, | ||
false => NoText | ||
}; | ||
set | ||
{ | ||
SelectedValue = value switch | ||
{ | ||
string s when s == UnknownText => null, | ||
string s when s == YesText => true, | ||
string s when s == NoText => false, | ||
_ => SelectedValue | ||
}; | ||
} | ||
} | ||
} |
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 @@ | ||
@using Microsoft.AspNetCore.Components.Web |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
// This is a JavaScript module that is loaded on demand. It can export any number of | ||
// functions, and may import other JavaScript modules if required. | ||
|
||
export function showPrompt(message) { | ||
return prompt(message, 'Type anything here'); | ||
} |
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
11 changes: 5 additions & 6 deletions
11
src/Blazor.Security/Models/ApplicationAuthenticationState.cs
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,11 +1,10 @@ | ||
namespace Dgmjr.Blazor.Security.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Dgmjr.Blazor.Security.Models; | ||
|
||
public partial class ApplicationAuthenticationState | ||
public readonly record struct ApplicationAuthenticationState | ||
{ | ||
public bool IsAuthenticated { get; set; } | ||
public string Name { get; set; } | ||
public IEnumerable<ApplicationClaim> Claims { get; set; } | ||
public bool IsAuthenticated { get; init; } | ||
public string Name { get; init; } | ||
public IEnumerable<ApplicationClaim> Claims { get; init; } | ||
} |
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
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