-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cefa444
commit 4626578
Showing
6 changed files
with
76 additions
and
48 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
56 changes: 56 additions & 0 deletions
56
BlazorCslaAuthentication/BlazorCslaAuthentication/Shared/CredentialValidator.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using Csla; | ||
|
||
namespace BlazorCslaAuthentication.Shared | ||
{ | ||
/// <summary> | ||
/// Verifies the supplied user credentials and | ||
/// returns information about the verified user. | ||
/// </summary> | ||
[Serializable] | ||
public class CredentialValidator : ReadOnlyBase<CredentialValidator> | ||
{ | ||
public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(nameof(Name)); | ||
public string Name | ||
{ | ||
get => GetProperty(NameProperty); | ||
private set => LoadProperty(NameProperty, value); | ||
} | ||
|
||
public static readonly PropertyInfo<string> AuthenticationTypeProperty = RegisterProperty<string>(nameof(AuthenticationType)); | ||
public string AuthenticationType | ||
{ | ||
get => GetProperty(AuthenticationTypeProperty); | ||
private set => LoadProperty(AuthenticationTypeProperty, value); | ||
} | ||
|
||
public static readonly PropertyInfo<Csla.Core.MobileList<string>> RolesProperty = RegisterProperty<Csla.Core.MobileList<string>>(nameof(Roles)); | ||
public Csla.Core.MobileList<string> Roles | ||
{ | ||
get => GetProperty(RolesProperty); | ||
private set => LoadProperty(RolesProperty, value); | ||
} | ||
|
||
[Fetch] | ||
private void Fetch(UserCredentials credentials) | ||
{ | ||
// validate credentials here | ||
if (!string.IsNullOrWhiteSpace(credentials.Username)) | ||
{ | ||
Name = credentials.Username; | ||
AuthenticationType = "Custom"; | ||
Roles = new Csla.Core.MobileList<string> | ||
{ | ||
"StandardUser", | ||
"PersonCreator" | ||
}; | ||
} | ||
else | ||
{ | ||
Name = string.Empty; | ||
AuthenticationType = string.Empty; | ||
Roles = new Csla.Core.MobileList<string>(); | ||
} | ||
} | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
BlazorCslaAuthentication/BlazorCslaAuthentication/Shared/CustomIdentity.cs
This file was deleted.
Oops, something went wrong.
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