- PresentIT
A web application to allow the easy uploading of videos for job applications
Everything described here presumes running via Kestral Web Server, unless specified otherwise.
In order to run this project, there are a couple of pre-requisites
Head on over to Auth0 to create an account
Once signed up, create an application called PresentIT using the Regular Web Applications template, grab a note of the following, we'll need to add these to our appsettings.json
- ClientID
- ClientSecret
- Domain
We also need to add the following address in the Allowed Callback URLs section of the application settings: https://localhost:5001/callback
- SqlServer
Can be run easily in a docker container by running
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=P@55Word123!' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
If you're inclined to, you can connect to the DB via Visual Studio or Visual Studio Code
-
Open View -> Server Explorer
-
Click on the
connect to database icon on the toolbar -
Enter the
Server nameaslocalhost, change the authentication type toSQL Server Authenticationand provide a username ofsaand a password to whatever you provided the password to be in the docker command above- tbc
We need a place to store the settings, if you're not using user secrets, then next logical place is in appsettings.json, below is an example appsettings.json which you can copy/paste and change the relevant parts
{
"ConnectionStrings": {
"DBConection": "Data Source=localhost;User ID=sa;Password=P@55Word123!"
},
"Auth0": {
"Domain": "your-auth0-domain.eu.auth0.com",
"ClientId": "your-auth0-ClientId",
"ClientSecret": "your-auth0-ClientSecret"
}
}Update-Database
Once you've ran the application, and created a new user go to the auth0 dashboard for your application.
-
Go to
User Management->Roles, and create a role ofemployer -
Go to
User Management->Users, find and click on the user you want to assign the role to, and select theRolestab, click theAssign Rolesbutton, select the role and clickAssign -
Go to
Auth Pipelines->Rules, clickCreate Rule, use theSet roles to a usertemplate and paste the following codefunction (user, context, callback) { const namespace = 'http://schemas.microsoft.com/ws/2008/06/identity/claims/roles'; const assignedRoles = (context.authorization || {}).roles; const idTokenClaims = context.idToken || {}; idTokenClaims[namespace] = assignedRoles; callback(null, user, context); }