The trial source package
In this article
In addition to providing you the implementation of data models, migrations, repositories, dependency injection components, that ASPSecurityKit requires to give you the unmatched flexibility and extensibility, the Premium source package also gives you the implementation of several important common workflows including,
- Account management (register, login, two-factor auth, forgot password, account settings, IP firewall management, email verification)
- User management (add/remove/suspend users, permissions)
- Administration (impersonation, transfer)
- Security event notifications
- Production-ready error handling
and much more, right into your project as source code – models, views, controllers or API endpoints with best practices (async, managers, dependency injection, error handling) – without writing a single line of code!
A trial of the premium source package is available to let you evaluate these capabilities. In the following sections, we’ll set you up with a sample project with it.
Note
Trial source packages aren’t available at the moment for .NET Framework libraries (ASP.NET MVC5 or Web API), but ASP.NET Core based trial gives you a similar experience to evaluate capabilities of ASPSecurityKit. However, if you feel you must evaluate ASPSecurityKit on .NET Framework, you can contact us at [email protected] and we’ll be happy to help.
Prerequisites
- You need to register on the dashboard to install a trial source package. There’s no fee to sign up. A dashboard account is necessary to use the ASPSecurityKit’s NuGet Tools.
- Of course you need a compatible Visual Studio version installed; for the sake of this walkthrough, we recommend VS2019 or higher with ASP.NET Core 3.1, though you should be able to use prior versions of Visual Studio such as VS2017.
Choose a platform
Create the project
-
In Visual Studio, open the Create a new project dialog.
-
Choose the programming language as CSharp and ASP.NET Core Empty as the template.
- Provide the project name and other information.
- Choose the target framework as ‘.NET Core 3.1’ and click on the Create button.
Install the ASPSecurityKit library package
As part of this step, we’ll install the ASPSecurityKit.NetCore NuGet package, which provides full ASPSecurityKit capabilities to build secure and reliable API platforms/services on ASP.NET Core. Check out the comprehensive security pipeline article to understand the multi-stage identity and access verification workflow ASPSecurityKit provides.
-
Open Package Manager (PM) Console and make sure that the selected project is the web application project just created.
-
Type the following command and hit enter:
install-package ASPSecurityKit.NetCore
-
Make sure that the package installs successfully
You can also use the Package Manager UI to install the above package.
Install the source package into the project
As part of this step, we’ll install the trial source package for ASP.NET Core Web API.
Note
Being a trial package, a major portion of the source code is instead delivered as part of a demo binary (dll) assembly file.
Follow these steps to install a source package. On the ‘Install a Source Package’ screen, make sure you select NetCoreApi as the platform and Trial as the source package.
On clicking Next, specify application configuration:
Upon successful installation, you should see several new items added to the project, along with a lib folder having the demo assembly.
Create the database
The Trial-ASP.NET Core API source package we had installed in the prior step, comes with EF migrations and T-SQL scripts, so you can create the database backing the models of your new project immediately.
- Verify the connectionString: Open appsettings.json file from Solution Explorer and verify that the DefaultConnection has a valid connectionString as per SQL Server version available on your machine. If it’s not, make the appropriate changes.
- Open Package Manager Console and make sure that the selected project is the web application project we’ve been working with in this walkthrough.
- Type the following command and hit enter:
update-database -Context DemoDbContext
- If you receive an error stating something like:
- “The term update-database is not recognized as the name of a cmdlet, function, script file, or operable program.”, you should close and restart Visual Studio, and open the same solution. For more information about this issue, check out the troubleshooting section.
- Make sure that the database is created successfully.
- You will see messages something like “Applying migration …”. If all goes well, the last message that you see is “Done” (with EF Core; with EF framework, it’s “Running seed method”).
Application Configuration
The Trial-ASP.NET Core API source package has also come up with some useful configuration settings that the accompanying components make use of. You can have a look at them in the ‘app’ section of the appsettings.json file in the project root.
By default, most are populated with the default value or values you provided on the second step of the ‘Install a Source Package’ screen. The following settings related to email component aren’t populated by default and are required for email verification and forgot password flows to work:
"app": {
....
"MailId": "[email protected]",
"MailPassword": "password",
"MailProvider": "Gmail",
// "MailHost": "",
// "MailPort": "",
// "MailUseSSL": "",
// "MailFrom": "",
....
},
The above settings are used by the Mailer
component you get as part of the source package. MailId
and MailPassword
settings represent the SMTP credentials.
MailProvider
setting can take one of six values: MailGun
, SendGrid
, Gmail
, Outlook
, Yahoo
and Custom
.
Additionally, you can use a setting MailFrom
to specify the ‘from address’ if it’s different from the MailId
(the username). This is usually true when you’re using a service like MailGun or SendGrid.
With Custom
provider you need to at least specify the MailHost
which should be the SMTP server host name. Custom
lets you configure services like Amazon SES to send emails.
As you get the source with the Premium package, you can further extend the Mailer
component if you want any further customization.
Note
To use Gmail, you need to enable “Less secure app access” etc. on your Gmail account. For more information, visit the support page.
We’re done, Let’s give it a run!
Press F5/Ctrl+F5 to run the application. Try signing up a new user. You can sign in using the super admin credentials – username as the one you gave during the source package installation (which you can also find in the appsettings.json file) and the default password ‘admin’. Try out flows like account settings.
Create the project
-
In Visual Studio, open the Create a new project dialog.
-
Choose the programming language as CSharp and ASP.NET Core Empty as the template.
- Provide the project name and other information.
- Choose the target framework as ‘.NET Core 3.1’ and click on the Create button.
Install the ASPSecurityKit library package
As part of this step, we’ll install the ASPSecurityKit.NetCore NuGet package, which provides full ASPSecurityKit capabilities to build secure and reliable modern MVC web applications on ASP.NET Core. Check out the comprehensive security pipeline article to understand the multi-stage identity and access verification workflow ASPSecurityKit provides.
-
Open Package Manager (PM) Console and make sure that the selected project is the web application project just created.
-
Type the following command and hit enter:
install-package ASPSecurityKit.NetCore
-
Make sure that the package installs successfully
You can also use the Package Manager UI to install the above package.
Install the source package into the project
As part of this step, we’ll install the trial source package for ASP.NET Core MVC.
Note
Being a trial package, a major portion of the source code is instead delivered as part of a demo binary (dll) assembly file.
Follow these steps to install a source package. On the ‘Install a Source Package’ screen, make sure you select NetCoreMvc as the platform and Trial as the source package.
On clicking Next, specify application configuration:
Upon successful installation, you should see several new items added to the project, along with a lib folder having the demo assembly.
Next, make sure you also install the node dependencies. The Trial ASP.NET Core Mvc source package we’ve just installed have some script dependencies such as bootstrap, jquery, jtable, etc. which have been configured as NPM dependencies.
Create the database
The Trial-ASP.NET Core MVC source package we had installed in the prior step, comes with EF migrations and T-SQL scripts, so you can create the database backing the models of your new project immediately.
- Verify the connectionString: Open appsettings.json file from Solution Explorer and verify that the DefaultConnection has a valid connectionString as per SQL Server version available on your machine. If it’s not, make the appropriate changes.
- Open Package Manager Console and make sure that the selected project is the web application project we’ve been working with in this walkthrough.
- Type the following command and hit enter:
update-database -Context DemoDbContext
- If you receive an error stating something like:
- “The term update-database is not recognized as the name of a cmdlet, function, script file, or operable program.”, you should close and restart Visual Studio, and open the same solution. For more information about this issue, check out the troubleshooting section.
- Make sure that the database is created successfully.
- You will see messages something like “Applying migration …”. If all goes well, the last message that you see is “Done” (with EF Core; with EF framework, it’s “Running seed method”).
Application Configuration
The Trial-ASP.NET Core MVC source package has also come up with some useful configuration settings that the accompanying components make use of. You can have a look at them in the ‘app’ section of the appsettings.json file in the project root.
By default, most are populated with the default value or values you provided on the second step of the ‘Install a Source Package’ screen. The following settings related to email component aren’t populated by default and are required for email verification and forgot password flows to work:
"app": {
....
"MailId": "[email protected]",
"MailPassword": "password",
"MailProvider": "Gmail",
// "MailHost": "",
// "MailPort": "",
// "MailUseSSL": "",
// "MailFrom": "",
....
},
The above settings are used by the Mailer
component you get as part of the source package. MailId
and MailPassword
settings represent the SMTP credentials.
MailProvider
setting can take one of six values: MailGun
, SendGrid
, Gmail
, Outlook
, Yahoo
and Custom
.
Additionally, you can use a setting MailFrom
to specify the ‘from address’ if it’s different from the MailId
(the username). This is usually true when you’re using a service like MailGun or SendGrid.
With Custom
provider you need to at least specify the MailHost
which should be the SMTP server host name. Custom
lets you configure services like Amazon SES to send emails.
As you get the source with the Premium package, you can further extend the Mailer
component if you want any further customization.
Note
To use Gmail, you need to enable “Less secure app access” etc. on your Gmail account. For more information, visit the support page.
We’re done, Let’s give it a run!
Press F5/Ctrl+F5 to run the application. Try signing up a new user. You can sign in using the super admin credentials – username as the one you gave during the source package installation (which you can also find in the appsettings.json file) and the default password ‘admin’. Try out flows like account settings.
Create the project
-
In Visual Studio, open the Create a new project dialog.
-
Choose the programming language as CSharp and ASP.NET Core Empty as the template.
- Provide the project name and other information.
- Choose the target framework as ‘.NET Core 3.1’ and click on the Create button.
Install the ASPSecurityKit library package
As part of this step, we’ll install the ASPSecurityKit.ServiceStack NuGet package, which provides full ASPSecurityKit capabilities to build secure and reliable API platforms/services on ServiceStack. Check out the comprehensive security pipeline article to understand the multi-stage identity and access verification workflow ASPSecurityKit provides.
-
Open Package Manager (PM) Console and make sure that the selected project is the web application project just created.
-
Type the following command and hit enter:
install-package ASPSecurityKit.ServiceStack
-
Make sure that the package installs successfully
You can also use the Package Manager UI to install the above package.
Install the source package into the project
As part of this step, we’ll install the trial source package for ServiceStack (.NET Core).
Note
Being a trial package, a major portion of the source code is instead delivered as part of a demo binary (dll) assembly file.
Follow these steps to install a source package. On the ‘Install a Source Package’ screen, make sure you select NetCoreServiceStack as the platform and Trial as the source package.
On clicking Next, specify application configuration:
Upon successful installation, you should see several new items added to the project, along with a lib folder having the demo assembly.
Create the database
The Trial-ServiceStack .NET Core source package we had installed in the prior step, comes with EF migrations and T-SQL scripts, so you can create the database backing the models of your new project immediately.
- Verify the connectionString: Open appsettings.json file from Solution Explorer and verify that the DefaultConnection has a valid connectionString as per SQL Server version available on your machine. If it’s not, make the appropriate changes.
- Open Package Manager Console and make sure that the selected project is the web application project we’ve been working with in this walkthrough.
- Type the following command and hit enter:
update-database -Context DemoDbContext
- If you receive an error stating something like:
- “The term update-database is not recognized as the name of a cmdlet, function, script file, or operable program.”, you should close and restart Visual Studio, and open the same solution. For more information about this issue, check out the troubleshooting section.
- Make sure that the database is created successfully.
- You will see messages something like “Applying migration …”. If all goes well, the last message that you see is “Done” (with EF Core; with EF framework, it’s “Running seed method”).
Application Configuration
The Trial-ServiceStack .NET Core source package has also come up with some useful configuration settings that the accompanying components make use of. You can have a look at them in the ‘app’ section of the appsettings.json file in the project root.
By default, most are populated with the default value or values you provided on the second step of the ‘Install a Source Package’ screen. The following settings related to email component aren’t populated by default and are required for email verification and forgot password flows to work:
"app": {
....
"MailId": "[email protected]",
"MailPassword": "password",
"MailProvider": "Gmail",
// "MailHost": "",
// "MailPort": "",
// "MailUseSSL": "",
// "MailFrom": "",
....
},
The above settings are used by the Mailer
component you get as part of the source package. MailId
and MailPassword
settings represent the SMTP credentials.
MailProvider
setting can take one of six values: MailGun
, SendGrid
, Gmail
, Outlook
, Yahoo
and Custom
.
Additionally, you can use a setting MailFrom
to specify the ‘from address’ if it’s different from the MailId
(the username). This is usually true when you’re using a service like MailGun or SendGrid.
With Custom
provider you need to at least specify the MailHost
which should be the SMTP server host name. Custom
lets you configure services like Amazon SES to send emails.
As you get the source with the Premium package, you can further extend the Mailer
component if you want any further customization.
Note
To use Gmail, you need to enable “Less secure app access” etc. on your Gmail account. For more information, visit the support page.
We’re done, Let’s give it a run!
Press F5/Ctrl+F5 to run the application. Try signing up a new user. You can sign in using the super admin credentials – username as the one you gave during the source package installation (which you can also find in the appsettings.json file) and the default password ‘admin’. Try out flows like account settings.