Federated Identity - Robertsegee/SEC440 GitHub Wiki
Creating Oauth Test in Github/WAN
Overview + initial
The first step is to create a test Oauth app on my WAN box to then be eventually done in production on AWS
- Under Settings->Developer Settings, Create an OAuth Application in Github which will generate
- A client ID (this is public)
- A client Secret (guard this like a private key)
- You will need to specify the Home Page and Callback URL of your application
sudo apt-get update -y
Flask
apt install python3-pip build-essential libffi-dev python3-dev python3-setuptools libssl-dev
apt install python3.10-venv
pip3 install virtualenvwrapper
- Create a directory called
/oauthlab/in the~directory
vim create ~/oauthlab/creds.json
{
"client_id":"potato",
"client_secret":"carrot",
"authorization_base_url":"https://github.com/login/oauth/authorize",
"token_url":"https://github.com/login/oauth/access_token"
}
- Replace potato with client id found when making oauth app
- Replace carrot with client secret found when making oauth app
vim create ~/oauthlab/webapp.py
webapp.py code
python3 -m venv ~/oauthlab/venv
source ~/oauthlab/venv/bin/activate
Now install requirements
pip3 install wheel
pip3 install Flask
pip3 install pyOpenSSL
pip3 install requests_oauthlib
Start it
python3 ~/oauthlab/webapp.py
Navigate to https://127.0.0.1:5000
AWS
Essentially the same exact steps but the main change is that you are going to set this as your ec2 pub address
- Use a ubuntu 22.04 free Ec2 instance for this
Reflection
Overall I found this lab to be enjoyable as I got to experiment with Oauth and combine it with AWS, this will help me in the future if I end up going towards aws or cloud based environments