Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
updates added to work with dotnet 6
Browse files Browse the repository at this point in the history
  • Loading branch information
speudusa committed Dec 1, 2022
2 parents cdad1e2 + 7fb1150 commit 6a08e62
Show file tree
Hide file tree
Showing 17 changed files with 263 additions and 221 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/appendices/figures/launchpad-view-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 36 additions & 18 deletions src/appendices/postman-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,51 @@ tool that puts you in full control of configuring and executing API requests.

Installing Postman is easy thanks to its cross-platform nature. You can download the installer on `their downloads page <https://www.postman.com/downloads/>`_.

**Windows Users**: Select the *Windows x64* installer download then run the installer:
Mac Users
---------

.. figure:: figures/download-installer.png
:alt: Close up of webpage to install Postman, user selecting Windows x64 option
1. Select the version that matches the type of chip your Mac has. If you are unsure if you have an Intel chip or the Apple chip, click on the apple in the upper left corner of your screen.
Select *About This Mac*. Under *Processor* on the *Overview* tab, you will see the chip manufaturer.

Windows user should select the *Windows 64-bit* download option
.. figure:: figures/download-installer-mac.png
:alt: Postman installation page with two Mac options displayed

After installation, if Postman does not open automatically, locate the download and open it manually. Making an account can be useful, but if you do not
want to create one, select the link in grey at the bottom of the splash screen that reads: "Skip signing in and take me straight to the to the app":
2. After installation, you can open the app. Postman will first prompt you to make an account, but if you are uncomfortable doing so, at the bottom of the screen is the option to sign up for an account later.

.. figure:: figures/account.png
:alt: Postman splash screen for a new account
The main view of Postman is the launchpad view.

You may skip the step to create an account
.. figure:: figures/launchpad-view-mac.png
:alt: Postman launchpad view for Mac, contains overview of initial actions a user can make with the software

.. admonition:: Tip
You are ready to go!

**Windows Users**: Once installed, you can right-click the Postman icon and pin it to your taskbar for easy access in the future:
Windows Users
-------------

.. figure:: figures/pin-taskbar.png
:alt: User pins the Postman application to their taskbar on Windows
1. Select the *Windows x64* installer download then run the installer:

Pinning the Postman application to your Windows taskbar could make your life easier
.. figure:: figures/download-installer.png
:alt: Close up of webpage to install Postman, user selecting Windows x64 option

You can leave the launchpad view open for now. We will explore Postman after setting up our API server.
Windows user should select the *Windows 64-bit* download option

.. figure:: figures/launchpad-view.png
:alt: Postman launchpad view, contains overview of initial actions a user can make with the software
2. After installation, if Postman does not open automatically, locate the download and open it manually. Making an account can be useful, but if you do not want to create one, select the link in grey at the bottom of the splash screen that reads: "Skip signing in and take me straight to the to the app":

Now that Postman is installed, there are a lot of features of the software to explore
.. figure:: figures/account.png
:alt: Postman splash screen for a new account

.. admonition:: Tip

**Windows Users**: Once installed, you can right-click the Postman icon and pin it to your taskbar for easy access in the future:

.. figure:: figures/pin-taskbar.png
:alt: User pins the Postman application to their taskbar on Windows

Pinning the Postman application to your Windows taskbar could make your life easier

3. You can leave the launchpad view open for now. We will explore Postman after setting up our API server.

.. figure:: figures/launchpad-view.png
:alt: Postman launchpad view, contains overview of initial actions a user can make with the software

Now that Postman is installed, there are a lot of features of the software to explore
6 changes: 5 additions & 1 deletion src/assignments/tech-jobs-mvc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ In this project, you’ll show that you can:
#. Use Razor syntax to display data within a view.
#. Create new action methods to process form submission.



TechJobs (MVC Edition)
----------------------

Expand Down Expand Up @@ -70,6 +72,8 @@ carefully as you solve each problem.
to finish the rest. First, you'll create a controller method to retrieve search results.
#. Finally, you'll display search results in the view.

Throughout your work, refer to our `demo app <https://csharp-mvc.launchcodetechnicaltraining.org/>`_ as needed to clarify questions about intended application behavior.

Getting Started
----------------

Expand Down Expand Up @@ -353,4 +357,4 @@ Here are some additional challenges, for those willing to take them on:
hyperlinked to a new listing of all jobs with that same value. For example,
if we have a list of jobs with the ``JavaScript`` skill, clicking on a
location value like ``Saint Louis`` will generate a new list with all the
jobs available in that city.
jobs available in that city.
2 changes: 2 additions & 0 deletions src/assignments/tech-jobs-persistent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ you'll need to do the work to connect the project to a database for storing user

Each of the three sections of this assignment will also ask you to demonstrate your SQL skills under an item labelled **SQL TASK**.

As you work through each part, refer to our `demo app <https://techjobs-persistent.launchcodetechnicaltraining.org/>`_ to clarify questions about intended application behavior.

Getting Started
----------------

Expand Down
51 changes: 25 additions & 26 deletions src/chapters/auth/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,47 @@ The first place to start with configuring Identity to fit the needs of the proje
Try and code along as you read more about Identity!
This page starts off with the code in the `identity-scaffolding <https://github.com/LaunchCodeEducation/CodingEventsDemo/tree/identity-scaffolding>`__ branch in ``CodingEventsDemo``.
The final code for this page is in the `identity-config <https://github.com/LaunchCodeEducation/CodingEventsDemo/tree/identity-config>`__ branch in ``CodingEventsDemo``.

If you are looking for an additional walkthrough, check out this `article <https://learn.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?source=recommendations&view=aspnetcore-6.0>`__ from Microsoft.

``Startup.cs``
--------------

``ConfigureServices()``
^^^^^^^^^^^^^^^^^^^^^^^

The first place that we may want to customize our settings is at the bottom of ``ConfigureServices()``.
When you were testing out your application, you may have accidentally entered an invalid password.
The validation conditions for a user's password is an example of one of the settings that can be configured here by using a method called ``services.Configure<IdentityOptions>()``.
If we wanted to make the minimum number of characters for our password 10 as opposed to 6, we would do the following.
Now that we are getting to configure our user, let's check out the code in ``ConfigureServices()``.
Earlier you may have added the following:

.. sourcecode:: csharp
:linenos:

services.Configure<IdentityOptions>( options =>
options.Password.RequiredLength = 10
);
services.AddDefaultIdentity<IdentityUser>
(options =>
{
options.SignIn.RequireConfirmedAccount = true;
options.Password.RequireDigit = false;
options.Password.RequiredLength = 10;
options.Password.RequireNonAlphanumeric = false;
options.Password.RequireUppercase = true;
options.Password.RequireLowercase = false;
}).AddEntityFrameworkStores<EventDbContext>();

For a full list of the default settings for users' passwords and how we can change those settings, check out the `documentation <https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.passwordoptions?view=aspnetcore-3.1>`__.
This code is dictating the settings for account creation. Right now, for a user to create an account, they have to have the following:

In ``ConfigureServices()``, we can also configure cookie settings, password hashers, user validation requirements, sign in settings and more.
#. They have to click a link to confirm their account.
#. Their password has to be more than 10 characters long.
#. Their password has to include an uppercase letter(s).

``Configure()``
^^^^^^^^^^^^^^^
The following is not true for a user to create an account.

Below ``ConfigureServices()``, you will find ``Configure()``. Inside ``Configure()``, we must make sure we have the following:
#. Their password does not have to include a number.
#. Their password does not have to include a special character such as a question mark.
#. Their password does not have to include lowercase letters.

.. sourcecode:: csharp
:linenos:
These are just some basic requirements that can be changed to suit the needs of your application.
For a full list of the default settings for users' passwords and how we can change those settings, check out the `documentation <https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.passwordoptions?view=aspnetcore-6.0>`__.

app.UseRouting();

app.UseAuthentication();
app.UseAuthorization();

While we did properly scaffold Identity onto our code base, we need to add the calls to ``UseAuthentication()`` and ``UseAuthorization()``.
Our application uses middleware to relay requests between our application and our database.
By adding the calls to ``UseAuthentication()`` and ``UseAuthorization()``, we are specifying that we now need authentication middleware to handle these requests.
Authentication is not just about ensuring users are signed in. It is about protecting data at every point it passes through to make the application work.
In ``ConfigureServices()``, we can also configure cookie settings, password hashers, user validation requirements, sign in settings and more.

Additional Customizations
-------------------------
Expand All @@ -66,7 +66,6 @@ Here are some examples of what you can do with it.
.. admonition:: Note

If you want to customize user data, it is best to do so when initially scaffolding the app.
Identity has a default user class called ``IdentityUser``.
`IdentityUser <https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.entityframeworkcore.identityuser?view=aspnetcore-1.1>`__ has a number of properties that are important and relevant to storing user data.
However, when you read through the requirements you may notice that you need additional properties, such as the user's first and last name.
If you want to add custom properties, check out this `article <https://docs.microsoft.com/en-us/aspnet/core/security/authentication/add-user-data?view=aspnetcore-5.0&tabs=visual-studio>`__ from Microsoft.
If you want to add custom properties, check out this `article <https://learn.microsoft.com/en-us/aspnet/core/security/authentication/add-user-data?view=aspnetcore-6.0&tabs=visual-studio>`__ from Microsoft.
12 changes: 0 additions & 12 deletions src/chapters/auth/identity-management.rst

This file was deleted.

1 change: 0 additions & 1 deletion src/chapters/auth/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ Authentication
users
configuration
authorization
identity-management
studio

Loading

0 comments on commit 6a08e62

Please sign in to comment.