From 9fd064386b96a98d99b1c3bf90cc819f1fb2e885 Mon Sep 17 00:00:00 2001 From: Dom R <89942738+Magentaman24@users.noreply.github.com> Date: Wed, 23 Feb 2022 22:29:44 -0500 Subject: [PATCH 1/6] Gavan Quimby's and Dominik Ramut's Identity Work --- content/en/docs/Concepts/Identity.md | 136 +++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/content/en/docs/Concepts/Identity.md b/content/en/docs/Concepts/Identity.md index 7a84729e..f395e66a 100644 --- a/content/en/docs/Concepts/Identity.md +++ b/content/en/docs/Concepts/Identity.md @@ -5,7 +5,143 @@ weight: 31 description: > Lead in description for Identity --- +Identity is a core feature available on ASP.NET which provides a lot of functionality to websites and is a basis for overall web development. The heart of identity is it that gives web pages the ability for users to create and save accounts. Essentially this is a built in membership system. Data related to user accounts such as usernames, emails, passwords, names and dates can be saved into a SQL server database or other forms such as an Azure Table Storage. Some of identities features include the ability to: +-Create, read, update and delete user accounts +-Confirm a users account +-Authenticate and Authorize a users account +-Recover or reset an accounts password +-Enable two factor authentication with SMS or mobile application (ex. Steam Guard) +-Allow a web application to use external already established identities/accounts such as Microsoft, Facebook, Google, GitHub etc. + ## Identity +In order to apply identity to a web application, one's project must contain the Microsoft.AspNetCore.Identity.EntityFrameworkCore package. This will allow for identity data and schema (outline/diagram/model/datatype) to access the SQL Server via the Entity Framework Core. You will be able to find the identity services added to the project in the ConfigureServices method of the Startup class. Thanks to dependency injection these services will be usable throughout the entire application. In order to use Identity in the application UseIdentity must be called in the Configure method of Startup class. + +The IdentityDbContext class is the base class for the Entity Framework database context used for identity. This class has the constructors IdentityDbContext() which initializes a new instance of the class as well as the IdentityDbContext(DbContextOptions) which initializes a new instance of IdentityDbContext. The properties included in this class include: +-RoleClaims- This will get or set the DbSet of role claims. +-Roles- This will get or set the DbSet of roles. +-UserClaims- This will get or set the DbSet of User claims. +-UserLogins- This will get or set the DbSet of User logins. +-UserRoles- This will get or set the DbSet of User roles. +-Users- This will get or set the DbSet of Users. +-UserTokens- This will get or set the DbSet of User tokens. +-The only method in this class is OnModelCreating(ModelBuilder) which configures the schema needed for the identity framework. + +**Where is Identity in RoverCore?** +RoverCore uses ASP.NET 6 Identity. Some notable updates include simplified development, better performance, and productivity from the hot reload function. Using dependency injection, identity is useful in Rovercore due to the UserManager and SignInManager services. Both of those services are used in any controller if necessary. For Example +```C# + private readonly UserManager _userManager; + private readonly SignInManager _signInManager; + + public AccountController(UserManager userManager, SignInManager signInManager) + { + _userManager = userManager; + _signInManager = signInManager; + } + ``` + + + +**Customization of ApplicationUser/ApplicationRole** +An application role is a database principal that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Because application roles are a database principal, they can access other databases only through databases linked to a basic level or guest account. +An application user is a built-in user account that is used to perform integration and system back-end service to support a particular feature. Customization is limited by an application user due them being built-in and unable to be updated. +**userManager - What is it?** +userManager is a service that is available through dependency injection. It’s a class that handles the user’s role,which determines what is independent for their account. userManager is a class that controls the user by means of creating, deleting and updating the users. UserManager contains methods that find a user via username, email, and the User’s ID. userManager has functionality for adding/removing roles ie: Admin account versus a student account. userManager also includes generation of password hashes, validation of users and more additional privacy. +Examples: +```C# + Public class YourController : BasedController +{ +private readonly UserManager _userManager; + +public YourController(UserManager userManager) +{ + _userManager = userManager; + _userManager = signInManage; +} + ``` + + + +**signInManager- What is it?** +SignInManager is a service that is available through dependency injection. It’s a class that handles the user to sign in from the application. SignInManager authenticates the user which is simply logging the user in and out. Cookies are also dished out from SignInManager. Cookies are small blocks of data used to help users access a website. SignInManager uses Authentication Cookies which helps the website identify what account the user is on, and authenticates the user so they are logged in. +Examples: +```C# + Public class YourController : BasedController +{ +private readonly SignInManager _signInManager; + +public YourController(UserManager userManager) +{ +_userManager = userManager; +_userManager = signInManage; +} + ``` + + + +###Common Questions when Using Identity + + +**How can I get the currently logged in user?** + +```C# + var user = await _userManager.GetUser(User); + ``` + + +**How do I add a new user to a role?** + +```C# + // Add user to Admin role +var user = await _userManager.GetUser(User); +await _userManager.AddToRoleAsync(user, "Admin"); + ``` + + +**How do I create a user?** +Make sure you created a model class inside your models folders. A simple method that stores a new user in the database using a specified password : +```C# + var user = new ApplicationUser { Id = Guid.NewGuid().ToString(), UserName = "bill", Email = "bill@microsoft.com" }; +var result = await _userManager.CreateAsync(user, "password"); +if (result.Succeeded) +{ +_logger.LogInformation("User created a new account with password."); +} +``` + + +**How do I change a user's password?** +```C# +Public class ChangePasswordViewModel +{ +Public string CurrentPassword {get; set;} + +Public string NewPassword {get; set;} +} +``` + + +**How can I get a user by their username?** +```C# +string getUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); +``` + + + ## References +* https://github.com/RoverCore/Documentation/issues/7 +* https://github.com/RoverCore/RoverCore +* https://jakeydocs.readthedocs.io/en/latest/security/authentication/identity.html#:~:text=ASP.NET%20Core%20Identity%20is,Microsoft%20Account%2C%20Twitter%20and%20more. +* https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/application-roles?view=sql-server-ver15#:~:text=An%20application%20role%20is%20a,connect%20through%20a%20particular%20application. +* https://docs.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-6.0 +* https://www.tektutorialshub.com/asp-net-core/asp-net-core-identity-tutorial/ +* https://www.youtube.com/watch?v=egITMrwMOPU +* https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.entityframeworkcore.identitydbcontext?view=aspnetcore-6.0 +* https://youtu.be/OP_KDWlAgCQ +* https://youtu.be/1OaVUy1pRXA +* https://youtu.be/sPbDrqpme_w +* https://youtu.be/r7VzoLhFLd0 +* https://youtu.be/9d8DXXc71RI +* It was revealed to me in a dream + From 8bf3fcb3e0e6417f3aefaf9e8fc0a2cd4d65066b Mon Sep 17 00:00:00 2001 From: Dom R <89942738+Magentaman24@users.noreply.github.com> Date: Mon, 28 Feb 2022 21:58:27 -0500 Subject: [PATCH 2/6] Update Identity.md --- content/en/docs/Concepts/Identity.md | 47 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/content/en/docs/Concepts/Identity.md b/content/en/docs/Concepts/Identity.md index f395e66a..8ef9e359 100644 --- a/content/en/docs/Concepts/Identity.md +++ b/content/en/docs/Concepts/Identity.md @@ -5,30 +5,31 @@ weight: 31 description: > Lead in description for Identity --- +## What is identity? Identity is a core feature available on ASP.NET which provides a lot of functionality to websites and is a basis for overall web development. The heart of identity is it that gives web pages the ability for users to create and save accounts. Essentially this is a built in membership system. Data related to user accounts such as usernames, emails, passwords, names and dates can be saved into a SQL server database or other forms such as an Azure Table Storage. Some of identities features include the ability to: --Create, read, update and delete user accounts --Confirm a users account --Authenticate and Authorize a users account --Recover or reset an accounts password --Enable two factor authentication with SMS or mobile application (ex. Steam Guard) --Allow a web application to use external already established identities/accounts such as Microsoft, Facebook, Google, GitHub etc. +- Create, read, update and delete user accounts +- Confirm a users account +- Authenticate and Authorize a users account +- Recover or reset an accounts password +- Enable two factor authentication with SMS or mobile application (ex. Steam Guard) +- Allow a web application to use external already established identities/accounts such as Microsoft, Facebook, Google, GitHub etc. ## Identity -In order to apply identity to a web application, one's project must contain the Microsoft.AspNetCore.Identity.EntityFrameworkCore package. This will allow for identity data and schema (outline/diagram/model/datatype) to access the SQL Server via the Entity Framework Core. You will be able to find the identity services added to the project in the ConfigureServices method of the Startup class. Thanks to dependency injection these services will be usable throughout the entire application. In order to use Identity in the application UseIdentity must be called in the Configure method of Startup class. - -The IdentityDbContext class is the base class for the Entity Framework database context used for identity. This class has the constructors IdentityDbContext() which initializes a new instance of the class as well as the IdentityDbContext(DbContextOptions) which initializes a new instance of IdentityDbContext. The properties included in this class include: --RoleClaims- This will get or set the DbSet of role claims. --Roles- This will get or set the DbSet of roles. --UserClaims- This will get or set the DbSet of User claims. --UserLogins- This will get or set the DbSet of User logins. --UserRoles- This will get or set the DbSet of User roles. --Users- This will get or set the DbSet of Users. --UserTokens- This will get or set the DbSet of User tokens. --The only method in this class is OnModelCreating(ModelBuilder) which configures the schema needed for the identity framework. - -**Where is Identity in RoverCore?** -RoverCore uses ASP.NET 6 Identity. Some notable updates include simplified development, better performance, and productivity from the hot reload function. Using dependency injection, identity is useful in Rovercore due to the UserManager and SignInManager services. Both of those services are used in any controller if necessary. For Example +In order to apply identity to a web application, one's project must contain the `Microsoft.AspNetCore.Identity.EntityFrameworkCore` package. This will allow for identity data and schema (outline/diagram/model/datatype) to access the SQL Server via the Entity Framework Core. You will be able to find the identity services added to the project in the ConfigureServices method of the Startup class. Thanks to dependency injection these services will be usable throughout the entire application. In order to use Identity in the application, UseIdentity must be called in the Configure method of Startup class. + +The `IdentityDbContext` class is the base class for the Entity Framework database context used for identity. This class has the constructors ```C#IdentityDbContext()``` which initializes a new instance of the class as well as the `IdentityDbContext(DbContextOptions)` which initializes a new instance of IdentityDbContext. The properties included in this class include: +- RoleClaims- This will get or set the DbSet of role claims. +- Roles- This will get or set the DbSet of roles. +- UserClaims- This will get or set the DbSet of User claims. +- UserLogins- This will get or set the DbSet of User logins. +- UserRoles- This will get or set the DbSet of User roles. +- Users- This will get or set the DbSet of Users. +- UserTokens- This will get or set the DbSet of User tokens. +- The only method in this class is OnModelCreating(ModelBuilder) which configures the schema needed for the identity framework. + +## **Where is Identity in RoverCore?** +RoverCore uses ASP.NET 6's identity. Some notable updates include simplified development, better performance, and productivity from the hot reload function. Using dependency injection, identity is useful in Rovercore due to the UserManager and SignInManager services. Both of those services are used in any controller if necessary. For Example ```C# private readonly UserManager _userManager; private readonly SignInManager _signInManager; @@ -43,7 +44,7 @@ RoverCore uses ASP.NET 6 Identity. Some notable updates include simplified devel **Customization of ApplicationUser/ApplicationRole** -An application role is a database principal that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Because application roles are a database principal, they can access other databases only through databases linked to a basic level or guest account. +An application role is a database principal (entity which requests SQL Server resources) that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Due to the fact that application roles are a database principal, they can access other databases only through databases linked to a basic level or guest account. An application user is a built-in user account that is used to perform integration and system back-end service to support a particular feature. Customization is limited by an application user due them being built-in and unable to be updated. **userManager - What is it?** userManager is a service that is available through dependency injection. It’s a class that handles the user’s role,which determines what is independent for their account. userManager is a class that controls the user by means of creating, deleting and updating the users. UserManager contains methods that find a user via username, email, and the User’s ID. userManager has functionality for adding/removing roles ie: Admin account versus a student account. userManager also includes generation of password hashes, validation of users and more additional privacy. @@ -62,8 +63,8 @@ public YourController(UserManager userManager) -**signInManager- What is it?** -SignInManager is a service that is available through dependency injection. It’s a class that handles the user to sign in from the application. SignInManager authenticates the user which is simply logging the user in and out. Cookies are also dished out from SignInManager. Cookies are small blocks of data used to help users access a website. SignInManager uses Authentication Cookies which helps the website identify what account the user is on, and authenticates the user so they are logged in. +**signInManager** +SignInManager is a service that is available through dependency injection. It’s a class that handles the user to sign in from the application. SignInManager authenticates the user which is simply logging the user in and out. Cookies are also dished out from SignInManager. Cookies are small blocks of data used to help users access a website. SignInManager uses authentication cookies which helps the website identify what account the user is on, and verifies the user so they are logged in. Examples: ```C# Public class YourController : BasedController From 8d49fbfac3ed42e5e970e4a28ac631b292b75c70 Mon Sep 17 00:00:00 2001 From: Dom R <89942738+Magentaman24@users.noreply.github.com> Date: Mon, 28 Feb 2022 22:18:51 -0500 Subject: [PATCH 3/6] Fixed Link References --- content/en/docs/Concepts/Identity.md | 39 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/content/en/docs/Concepts/Identity.md b/content/en/docs/Concepts/Identity.md index 8ef9e359..3be740b9 100644 --- a/content/en/docs/Concepts/Identity.md +++ b/content/en/docs/Concepts/Identity.md @@ -46,7 +46,8 @@ RoverCore uses ASP.NET 6's identity. Some notable updates include simplified dev **Customization of ApplicationUser/ApplicationRole** An application role is a database principal (entity which requests SQL Server resources) that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Due to the fact that application roles are a database principal, they can access other databases only through databases linked to a basic level or guest account. An application user is a built-in user account that is used to perform integration and system back-end service to support a particular feature. Customization is limited by an application user due them being built-in and unable to be updated. -**userManager - What is it?** + +## **userManager** userManager is a service that is available through dependency injection. It’s a class that handles the user’s role,which determines what is independent for their account. userManager is a class that controls the user by means of creating, deleting and updating the users. UserManager contains methods that find a user via username, email, and the User’s ID. userManager has functionality for adding/removing roles ie: Admin account versus a student account. userManager also includes generation of password hashes, validation of users and more additional privacy. Examples: ```C# @@ -83,14 +84,14 @@ _userManager = signInManage; ###Common Questions when Using Identity -**How can I get the currently logged in user?** +####**How can I get the currently logged in user?** ```C# var user = await _userManager.GetUser(User); ``` -**How do I add a new user to a role?** +####**How do I add a new user to a role?** ```C# // Add user to Admin role @@ -99,7 +100,7 @@ await _userManager.AddToRoleAsync(user, "Admin"); ``` -**How do I create a user?** +####**How do I create a user?** Make sure you created a model class inside your models folders. A simple method that stores a new user in the database using a specified password : ```C# var user = new ApplicationUser { Id = Guid.NewGuid().ToString(), UserName = "bill", Email = "bill@microsoft.com" }; @@ -111,7 +112,7 @@ _logger.LogInformation("User created a new account with password."); ``` -**How do I change a user's password?** +####**How do I change a user's password?** ```C# Public class ChangePasswordViewModel { @@ -122,7 +123,7 @@ Public string NewPassword {get; set;} ``` -**How can I get a user by their username?** +####**How can I get a user by their username?** ```C# string getUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); ``` @@ -131,18 +132,18 @@ string getUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToS ## References -* https://github.com/RoverCore/Documentation/issues/7 -* https://github.com/RoverCore/RoverCore -* https://jakeydocs.readthedocs.io/en/latest/security/authentication/identity.html#:~:text=ASP.NET%20Core%20Identity%20is,Microsoft%20Account%2C%20Twitter%20and%20more. -* https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/application-roles?view=sql-server-ver15#:~:text=An%20application%20role%20is%20a,connect%20through%20a%20particular%20application. -* https://docs.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-6.0 -* https://www.tektutorialshub.com/asp-net-core/asp-net-core-identity-tutorial/ -* https://www.youtube.com/watch?v=egITMrwMOPU -* https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.entityframeworkcore.identitydbcontext?view=aspnetcore-6.0 -* https://youtu.be/OP_KDWlAgCQ -* https://youtu.be/1OaVUy1pRXA -* https://youtu.be/sPbDrqpme_w -* https://youtu.be/r7VzoLhFLd0 -* https://youtu.be/9d8DXXc71RI +* [Add Issue #7 Identity Documentation #12](https://github.com/RoverCore/Documentation/issues/7) +* [RoverCore](https://github.com/RoverCore/RoverCore) +* [Introduction to Identity](https://jakeydocs.readthedocs.io/en/latest/security/authentication/identity.html#:~:text=ASP.NET%20Core%20Identity%20is,Microsoft%20Account%2C%20Twitter%20and%20more.) +* [Application Roles](https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/application-roles?view=sql-server-ver15#:~:text=An%20application%20role%20is%20a,connect%20through%20a%20particular%20application.) +* [Identity model customization in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-6.0) +* [ASP.NET Core Identity Tutorial](https://www.tektutorialshub.com/asp-net-core/asp-net-core-identity-tutorial/) +* [ASP NET Core Identity tutorial from scratch](https://www.youtube.com/watch?v=egITMrwMOPU) +* [IdentityDbContext Class](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.entityframeworkcore.identitydbcontext?view=aspnetcore-6.0) +* [Get Current Logged In UserId of User in ASP.NET CORE Identity](https://youtu.be/OP_KDWlAgCQ) +* [Manage user roles in asp net core identity](https://youtu.be/1OaVUy1pRXA) +* [Register new user using asp net core identity](https://youtu.be/sPbDrqpme_w) +* [Change password in asp net core ](https://youtu.be/r7VzoLhFLd0) +* [Implementing login functionality in asp net core](https://youtu.be/9d8DXXc71RI) * It was revealed to me in a dream From 66dcc029bca8a62f3ea30b20fe64b96c7c826a98 Mon Sep 17 00:00:00 2001 From: Dom R <89942738+Magentaman24@users.noreply.github.com> Date: Tue, 1 Mar 2022 20:47:45 -0500 Subject: [PATCH 4/6] Fixed userManager and signinManager --- content/en/docs/Concepts/Identity.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/content/en/docs/Concepts/Identity.md b/content/en/docs/Concepts/Identity.md index 3be740b9..71dc5c41 100644 --- a/content/en/docs/Concepts/Identity.md +++ b/content/en/docs/Concepts/Identity.md @@ -29,7 +29,7 @@ The `IdentityDbContext` class is the base class for the Entity Framework databas - The only method in this class is OnModelCreating(ModelBuilder) which configures the schema needed for the identity framework. ## **Where is Identity in RoverCore?** -RoverCore uses ASP.NET 6's identity. Some notable updates include simplified development, better performance, and productivity from the hot reload function. Using dependency injection, identity is useful in Rovercore due to the UserManager and SignInManager services. Both of those services are used in any controller if necessary. For Example +RoverCore uses ASP.NET 6’s identity. Some notable updates include simplified development, better performance, and productivity from the hot reload function. Using dependency injection, identity is useful in RoverCore due to the UserManager and SignInManager services. Both of those services are used in any controller if necessary. For Example ```C# private readonly UserManager _userManager; private readonly SignInManager _signInManager; @@ -44,11 +44,10 @@ RoverCore uses ASP.NET 6's identity. Some notable updates include simplified dev **Customization of ApplicationUser/ApplicationRole** -An application role is a database principal (entity which requests SQL Server resources) that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Due to the fact that application roles are a database principal, they can access other databases only through databases linked to a basic level or guest account. +An application role is an entity that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Because application roles are entities, they can access other databases only through databases linked to a basic level or guest account. An application user is a built-in user account that is used to perform integration and system back-end service to support a particular feature. Customization is limited by an application user due them being built-in and unable to be updated. - -## **userManager** -userManager is a service that is available through dependency injection. It’s a class that handles the user’s role,which determines what is independent for their account. userManager is a class that controls the user by means of creating, deleting and updating the users. UserManager contains methods that find a user via username, email, and the User’s ID. userManager has functionality for adding/removing roles ie: Admin account versus a student account. userManager also includes generation of password hashes, validation of users and more additional privacy. +## **What is a userManager?** +A class that can handle a user’s role and account on a website is called UserManager.The background of UserManager is that it’s a class that controls the user by means of creating, deleting and updating the users. There are various methods of UserManager you can use that can find a user via username, email, and the User’s ID. The functionality of UserManager includes adding/removing roles ie: Admin account versus a student account. Lastly also includes generation of password hashes, validation of users and more additional privacy. Examples: ```C# Public class YourController : BasedController @@ -64,9 +63,9 @@ public YourController(UserManager userManager) -**signInManager** -SignInManager is a service that is available through dependency injection. It’s a class that handles the user to sign in from the application. SignInManager authenticates the user which is simply logging the user in and out. Cookies are also dished out from SignInManager. Cookies are small blocks of data used to help users access a website. SignInManager uses authentication cookies which helps the website identify what account the user is on, and verifies the user so they are logged in. -Examples: +**What is a signInManager?** +A service that is available through dependency injection is known as SignInManager. It’s a class that handles the user to sign in from the application. The service authenticates the user which is simply logging the user in and out. Cookies are also dished out from SignInManager. Cookies are small blocks of data used to help users access a website. Authentication cookies help the website identify what account the user is on. Here are some examples. + ```C# Public class YourController : BasedController { From 335e02baaf3036c3ebf98da99ed1566f523ed9e2 Mon Sep 17 00:00:00 2001 From: Dom R <89942738+Magentaman24@users.noreply.github.com> Date: Wed, 2 Mar 2022 13:18:59 -0500 Subject: [PATCH 5/6] Update Identity.md --- content/en/docs/Concepts/Identity.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/en/docs/Concepts/Identity.md b/content/en/docs/Concepts/Identity.md index 71dc5c41..aab6d225 100644 --- a/content/en/docs/Concepts/Identity.md +++ b/content/en/docs/Concepts/Identity.md @@ -28,7 +28,7 @@ The `IdentityDbContext` class is the base class for the Entity Framework databas - UserTokens- This will get or set the DbSet of User tokens. - The only method in this class is OnModelCreating(ModelBuilder) which configures the schema needed for the identity framework. -## **Where is Identity in RoverCore?** +## Where is Identity in RoverCore? RoverCore uses ASP.NET 6’s identity. Some notable updates include simplified development, better performance, and productivity from the hot reload function. Using dependency injection, identity is useful in RoverCore due to the UserManager and SignInManager services. Both of those services are used in any controller if necessary. For Example ```C# private readonly UserManager _userManager; @@ -46,7 +46,7 @@ RoverCore uses ASP.NET 6’s identity. Some notable updates include simplified d **Customization of ApplicationUser/ApplicationRole** An application role is an entity that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Because application roles are entities, they can access other databases only through databases linked to a basic level or guest account. An application user is a built-in user account that is used to perform integration and system back-end service to support a particular feature. Customization is limited by an application user due them being built-in and unable to be updated. -## **What is a userManager?** +**What is a userManager?** A class that can handle a user’s role and account on a website is called UserManager.The background of UserManager is that it’s a class that controls the user by means of creating, deleting and updating the users. There are various methods of UserManager you can use that can find a user via username, email, and the User’s ID. The functionality of UserManager includes adding/removing roles ie: Admin account versus a student account. Lastly also includes generation of password hashes, validation of users and more additional privacy. Examples: ```C# @@ -80,17 +80,17 @@ _userManager = signInManage; -###Common Questions when Using Identity +### Common Questions when Using Identity -####**How can I get the currently logged in user?** +#### How can I get the currently logged in user? ```C# var user = await _userManager.GetUser(User); ``` -####**How do I add a new user to a role?** +#### How do I add a new user to a role? ```C# // Add user to Admin role @@ -99,7 +99,7 @@ await _userManager.AddToRoleAsync(user, "Admin"); ``` -####**How do I create a user?** +#### How do I create a user? Make sure you created a model class inside your models folders. A simple method that stores a new user in the database using a specified password : ```C# var user = new ApplicationUser { Id = Guid.NewGuid().ToString(), UserName = "bill", Email = "bill@microsoft.com" }; From baf19bda019c2ae6206b1c7b465129283da3c37c Mon Sep 17 00:00:00 2001 From: Dom R <89942738+Magentaman24@users.noreply.github.com> Date: Thu, 3 Mar 2022 19:40:04 -0500 Subject: [PATCH 6/6] Hopefully Final Changes If there are any more changes we need to make I and dropping ADS. --- content/en/docs/Concepts/Identity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/Concepts/Identity.md b/content/en/docs/Concepts/Identity.md index aab6d225..d47964c2 100644 --- a/content/en/docs/Concepts/Identity.md +++ b/content/en/docs/Concepts/Identity.md @@ -43,10 +43,10 @@ RoverCore uses ASP.NET 6’s identity. Some notable updates include simplified d -**Customization of ApplicationUser/ApplicationRole** +## Customization of ApplicationUser/ApplicationRole An application role is an entity that enables an application to run with its own permissions. You are able to customize the application role to enable access to specific data to only those users who go through the application in a specific way. Because application roles are entities, they can access other databases only through databases linked to a basic level or guest account. An application user is a built-in user account that is used to perform integration and system back-end service to support a particular feature. Customization is limited by an application user due them being built-in and unable to be updated. -**What is a userManager?** +**What is a userManager?** A class that can handle a user’s role and account on a website is called UserManager.The background of UserManager is that it’s a class that controls the user by means of creating, deleting and updating the users. There are various methods of UserManager you can use that can find a user via username, email, and the User’s ID. The functionality of UserManager includes adding/removing roles ie: Admin account versus a student account. Lastly also includes generation of password hashes, validation of users and more additional privacy. Examples: ```C#