If you had noticed from the previous steps, there was a
username
fieldfor all of the Todos, but the username
was always set to default
.This step will be utilizing the username
field by exposing the notionof users and authorization in the Todo application. For this section, we willbe doing the following to add authorization and users to the application:- What Is The Authorizer App On My Mac Os
- What Is The Authorizer App On My Macbook Pro
- What Is The Authorizer App On My Macbook
- What Is The Authorizer App On My Macbook Air
For authorization, the application is going to be relying on JWT. To dependon JWT, in the Chalice application
PyJWT
needs to be installed and addedto our requirements.txt
file.Instructions¶
To avoid manual typing of long and complex passwords everytime you need them, Authorizer provides Auto-Type features over USB and Bluetooth. It pretends to be a keyboard (e.g. Over an USB On-The-Go adapter) and with a button press inside the app, it will automatically type the password for you on your pc, laptop, tablet or other smartphone. Download the authorizer app for your SONiVOX product from the links below: Big Bang - Cinematic Percussion Big Bang - Universal Drums Eighty Eight Ensemble Twist 2.0 Vocalizer Pro Wobble 2.0; Double click the ZIP file you've downloaded to extract the authorizer app. Double click the authorizer app.
- Add
PyJWT
to yourrequirements.txt
file: - Make sure it is now installed in your virtualenv:
Verification¶
To ensure that it was installed, open the Python REPL and try to importthe
PyJWT
library:In order to add authentication to your Chalice application we have provided a fewfiles that help with some of the low-level details. We have added an
auth.py
fileto chalicelib
which abstracts away some of the details of handling JWT tokens. Wehave also added a users.py
script which is a command line utility for creating andmanaging a user table.![What What](/uploads/1/3/4/2/134209656/102240576.jpg)
Instructions¶
1) Copy in the
chalice-workshop/code/todo-app/part1/04-add-auth/chalicelib/auth.py
file:2) Copy over the
chalice-workshop/code/todo-app/part1/04-add-auth/users.py
script forcreating users:Verification¶
From within the
mytodo
directory of your Todo Chalice application, thestructure should be the following:Using the
createtable.py
script, this will create another DynamoDB tablefor storing users to use in the Chalice application.Instructions¶
- Run the
createtable.py
script to create the DynamoDB table:
Verification¶
Check that the return code of the command is
0
:Also
cat
the .chalice/config.json
to make sure the USERS_TABLE_NAME
shows up as an environment variable:Using the
users.py
script, create a new user in your users database touse with your chalice application.Instructions¶
- Run the
users.py
script with the-c
argument to create a user. Youwill be prompted for a username and a password:
Verification¶
Using the
users.py
script, make sure that the user is listed in yourdatabase:Also make sure that the password is correct by testing the username andpassword with the
users.py
script:You can also test an incorrect password. You should see this output:
Now that we have created a DynamoDB user table, we will create a convenience functionfor loading it.
Instructions¶
- Add a new variable
_USER_DB
in yourapp.py
file with a value of None:
- Create a function for fetching our current database table for users. Similar to thefunction that gets the app table. Add this function to your
app.py
file:
We will now create a login route where users can trade their username/password for aJWT token.
Instructions¶
- Define a new Chalice route
/login
that accepts the POST method and grabs theusername
andpassword
from the request, and forwards it along to a helperfunction in theauth
code you copied in earlier which will trade those for aJWT token.
- Notice the above code snippit uses the
auth
file that we copied into ourchalicelib directory at the beginning of this step. Add the followingimport statement to the top ofapp.py
so we can use it:
Verification¶
- Start up a local server using
chalicelocal
. - Using the username and password generated previously, run
chalicelocal
and make an HTTPPOST
request to the/login
URI:
This should return a JWT to use as an
Authorization
header for that user.To add authorization to our app we will start by defining an authorizer andattaching it to one of our routes.
Instructions¶
- Create an authorizer function that checks the validity of a JWT token using theexisting code in the
auth.py
file we copied earlier. If the token is valid(didn’t throw an error) we will return a policy that allows access to all of ourroutes, and sets theprincipal_id
to the username in the JWT token. - Once we have defined the authorizer, we will attach it to the
get_todos
route.
Also make sure to import the
AuthResponse
class at the top of the app.py
file:Verification¶
- Start the local dev server
chalicelocal
- Try to get the todo, the request should be rejected without authorization:
- Try the same call again but with your authorization token passed in the
Authorization
header:
Now attach the authorizer to all the other routes except the
login
route.Instructions¶
- Attach the
jwt_auth
authorizer to theadd_new_todo
route. - Attach the
jwt_auth
authorizer to theget_todo
route. - Attach the
jwt_auth
authorizer to thedelete_todo
route. - Attach the
jwt_auth
authorizer to theupdate_todo
route.
Verification¶
What Is The Authorizer App On My Mac Os
- Start up the local dev server
chalicelocal
- Try each route without an authorization token. You should get a
401
Unauthorized response:
- Now try to create, get, update, and delete a todo from your application byusing the
Authorization
header in all your requests:
Now that we have authorizers hooked up to all our routes we can use thatinstead of relying on the default user of
default
.Instructions¶
- First create a function named
get_authorized_username
that will be usedto convert the information we have in ourcurrent_request
into ausername.
- Now we need to update each function that interacts with our database tocalculate the
username
and pass it to thexxx_item
method.
Verification¶
- Spin up the local Chalice server with
chalicelocal
. - Create a new todo and pass in your auth token:
- List your todos using the get_todos route:
- Notice that now the username is no longer
default
it should be whatever usernamewent with the auth token you supplied. - Try making a new user with
pythonusers.py-c
and then get their JWT tokenby calling the login route with their credentials. - Call the same route as above as the new user by passing in their JWT token in the
Authorization
header. They should get no todos since they have not created anyyet:
Now that we have it working locally lets deploy it and verify that it still works.
Verification¶
- Try the same two calls above against the real API Gateway endpoint you get from yourdeploy instead of the localhost endpoint. If you lose your endpoint you can run
chaliceurl
which will print out your API Gateway endpoint:
When you are finished your
app.py
file should look like:You are using software and an OS installed by the previous owner. You need to wipe the drive completely, then install the original OS that came with the computer originally. It should be on an installer DVD the old owner should have provided. If you don't have the discs then you will need to get the retail Snow Leopard DVD: You can purchase Snow Leopard through the Apple Store:Mac OS X 10.6 Snow Leopard - Apple Store (U.S.). The price is $19.99 plus tax. You will be sent physical media by mail after placing your order.
After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store.
Clean Install of Snow Leopard
1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came Luna display mac app.
with your computer. Insert the disc into the optical drive and restart the computer.
After the chime press and hold down the 'C' key. Release the key when you see
a small spinning gear appear below the dark gray Apple logo.
2. After the installer loads select your language and click on the Continue
button. When the menu bar appears select Disk Utility from the Utilities menu.
After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
size.) Click on the Partition tab in the DU main window. Set the number of
partitions to one (1) from the Partitions drop down menu, click on Options button
and select GUID, click on OK, then set the format type to MacOS Extended
(Journaled, if supported), then click on the Apply button.
3. When the formatting has completed quit DU and return to the installer. Proceed
with the OS X installation and follow the directions included with the installer.
4. When the installation has completed your computer will Restart into the Setup
Assistant. After you finish Setup Assistant will complete the installation after which
you will be running a fresh install of OS X. You can now begin the update process
![What Is The Authorizer App On My Mac What Is The Authorizer App On My Mac](/uploads/1/3/4/2/134209656/984424652.jpg)
by opening Software Update and installing all recommended updates to bring your
installation current.
Download and install Mac OS X 10.6.8 Update Combo v1.1.
When you have 10.6.8 installed you can then access the App Store and download El Capitan:
Upgrading to El Capitan
To upgrade to El Capitan you must have Snow Leopard 10.6.8 or Lion installed. Download El Capitan from the App Store. Sign in using your Apple ID. El Capitan is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
Macs that can be upgraded to OS X El Capitan
1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
6. Mac portable apps suite. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
7. Xserve (Early 2009) - Model Identifier 3,1 or later
What Is The Authorizer App On My Macbook Pro
To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
What Is The Authorizer App On My Macbook
Are my applications compatible?
See App Compatibility Table - RoaringApps
What Is The Authorizer App On My Macbook Air
Feb 6, 2016 11:02 AM